# HG changeset patch # User Olaf Wintermann # Date 1765624795 -3600 # Node ID 61b811c4705f0cd72ee8cfd7d9d8e09909654411 # Parent 2f811eae24240c9ecb52656e3d9d96954dd7464c add support for static_elements in the listview/dropdown widgets (Motif) diff -r 2f811eae2424 -r 61b811c4705f ui/motif/list.c --- a/ui/motif/list.c Sat Dec 13 12:11:40 2025 +0100 +++ b/ui/motif/list.c Sat Dec 13 12:19:55 2025 +0100 @@ -95,6 +95,8 @@ listview->onselection = args->onselection; listview->onselectiondata = args->onselectiondata; + char **static_elements = args->static_elements; + size_t static_nelm = args->static_nelm; if(var) { UiList *list = var->value; list->obj = listview; @@ -102,6 +104,21 @@ list->getselection = ui_listview_getselection; list->setselection = ui_listview_setselection; ui_listview_update(list, 0); + } else if(static_elements && static_nelm > 0) { + XmStringTable items = calloc(static_nelm, sizeof(XmString)); + for(int i=0;iwidget, + XmNitems, items, + XmNitemCount, + static_nelm, + NULL); + for (int i=0;ionselection = args->onselection; listview->onselectiondata = args->onselectiondata; + char **static_elements = args->static_elements; + size_t static_nelm = args->static_nelm; if(var) { UiList *list = var->value; list->obj = listview; @@ -323,6 +342,21 @@ list->getselection = ui_dropdown_getselection; list->setselection = ui_dropdown_setselection; ui_listview_update(list, 0); + } else if(static_elements && static_nelm > 0) { + XmStringTable items = calloc(static_nelm, sizeof(XmString)); + for(int i=0;iwidget, + XmNitems, items, + XmNitemCount, + static_nelm, + NULL); + for (int i=0;i -#include - -#include "stock.h" -#include "../ui/properties.h" -#include - - diff -r 2f811eae2424 -r 61b811c4705f ui/motif/stock.h --- a/ui/motif/stock.h Sat Dec 13 12:11:40 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright 2014 Olaf Wintermann. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef STOCK_H -#define STOCK_H - -#include "../ui/stock.h" - -#ifdef __cplusplus -extern "C" { -#endif - - - -#ifdef __cplusplus -} -#endif - -#endif /* STOCK_H */ - diff -r 2f811eae2424 -r 61b811c4705f ui/motif/toolbar.c --- a/ui/motif/toolbar.c Sat Dec 13 12:11:40 2025 +0100 +++ b/ui/motif/toolbar.c Sat Dec 13 12:19:55 2025 +0100 @@ -33,7 +33,6 @@ #include "toolbar.h" #include "button.h" -#include "stock.h" #include "list.h" #include diff -r 2f811eae2424 -r 61b811c4705f ui/motif/toolkit.c --- a/ui/motif/toolkit.c Sat Dec 13 12:11:40 2025 +0100 +++ b/ui/motif/toolkit.c Sat Dec 13 12:19:55 2025 +0100 @@ -34,7 +34,6 @@ #include "toolkit.h" #include "toolbar.h" #include "container.h" -#include "stock.h" #include "../common/menu.h" #include "../common/toolbar.h" #include "../common/document.h"