Thu, 10 Sep 2026 17:36:06 +0200
define sourcelist2 widget
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 2026 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. */ #include "tree.h" #include "list.h" #include "container.h" #include "../common/context.h" UiListView* ui_create_treeview(UiObject *obj, UiTreeArgs *args) { UiListView *treeview = malloc(sizeof(UiListView)); memset(treeview, 0, sizeof(UiListView)); treeview->obj = obj; treeview->model = args->model; treeview->multiselection = args->multiselection; treeview->onactivate = args->onactivate; treeview->onactivatedata = args->onactivatedata; treeview->onactivate_action = args->onactivate_action ? strdup(args->onactivate_action) : NULL; treeview->onselection = args->onselection; treeview->onselectiondata = args->onselectiondata; treeview->onselection_action = args->onselection_action ? strdup(args->onselection_action) : NULL; treeview->ondragstart = args->ondragstart; treeview->ondragstartdata = args->ondragstartdata; treeview->ondragstart_action = args->ondragstart_action ? strdup(args->ondragstart_action) : NULL; treeview->ondragcomplete = args->ondragcomplete; treeview->ondragcompletedata = args->ondragcompletedata; treeview->ondragcomplete_action = args->ondragcomplete_action ? strdup(args->ondragcomplete_action) : NULL; treeview->ondrop = args->ondrop; treeview->ondropdata = args->ondropdata; treeview->ondrop_action = args->ondrop_action ? strdup(args->ondrop_action) : NULL; treeview->selection.count = 0; treeview->selection.rows = NULL; treeview->current_row = -1; #if GTK_CHECK_VERSION(4, 0, 0) treeview->coldata.listview = treeview; treeview->coldata.column = 0; #endif if(args->getvalue != NULL) { treeview->getvalue = args->getvalue; treeview->getvaluedata = args->getvaluedata; } else { args->getvalue = ui_null_getvalue; } treeview->istreeview = TRUE; treeview->getdepth = args->getdepth; treeview->getdepthdata = args->getdepthdata; return treeview; }