Sun, 24 Aug 2025 15:24:16 +0200
update toolkit, remove getvalue func from model to table/listview args
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2014 Olaf Wintermann. All rights reserved. |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #include <stdio.h> |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #include "container.h" |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
31 | #include "../common/object.h" |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
32 | |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
33 | #include <cx/mempool.h> |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | #include <QSpacerItem> |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | #include <QStackedWidget> |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
37 | #include <QLabel> |
|
109
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
38 | #include <QDockWidget> |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
40 | static void delete_container(UiContainerPrivate *ct) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
41 | delete ct; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
42 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
43 | |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
44 | void ui_container_add(UiObject *obj, UiContainerPrivate *ct) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
45 | UiContainerX *container = (UiContainerX*)ui_malloc(obj->ctx, sizeof(UiContainerX)); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
46 | container->close = 0; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
47 | container->container = ct; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
48 | container->prev = NULL; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
49 | container->next = NULL; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
50 | cxMempoolRegister(obj->ctx->mp, ct, (cx_destructor_func)delete_container); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
51 | uic_object_push_container(obj, container); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
52 | } |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | /* -------------------- UiBoxContainer -------------------- */ |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | UiBoxContainer::UiBoxContainer(QBoxLayout* box) { |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | this->box = box; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | box->setContentsMargins(QMargins(0,0,0,0)); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | box->setSpacing(0); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | ui_reset_layout(layout); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | |
|
108
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
64 | void UiBoxContainer::add(QWidget* widget) { |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
65 | bool fill = layout.fill; |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | if(hasStretchedWidget && fill) { |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | fill = false; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | fprintf(stderr, "UiError: container has 2 filled widgets"); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | |
|
108
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
71 | box->addWidget(widget); |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | if(!hasStretchedWidget) { |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | QSpacerItem *newspace = new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | box->removeItem(space); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | box->addSpacerItem(newspace); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | space = newspace; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | if(fill) { |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | hasStretchedWidget = true; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | ui_reset_layout(layout); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | current = widget; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | |
|
108
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
87 | UIWIDGET ui_box(UiObject *obj, UiContainerArgs *args, QBoxLayout::Direction dir) { |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
88 | UiContainerPrivate *ctn = (UiContainerPrivate*)ui_obj_container(obj); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
89 | UI_APPLY_LAYOUT(ctn->layout, args); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
90 | |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | QWidget *widget = new QWidget(); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | QBoxLayout *box = new QBoxLayout(dir); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | widget->setLayout(box); |
|
108
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
94 | ctn->add(widget); |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
96 | ui_container_add(obj, new UiBoxContainer(box)); |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | return widget; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | |
|
108
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
101 | UIWIDGET ui_vbox_create(UiObject *obj, UiContainerArgs *args) { |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
102 | return ui_box(obj, args, QBoxLayout::TopToBottom); |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | |
|
108
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
105 | UIWIDGET ui_hbox_create(UiObject *obj, UiContainerArgs *args) { |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
106 | return ui_box(obj, args, QBoxLayout::LeftToRight); |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | /* -------------------- UiGridContainer -------------------- */ |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
112 | UiGridContainer::UiGridContainer( |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
113 | QGridLayout *grid, |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
114 | int margin, |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
115 | int columnspacing, |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
116 | int rowspacing, |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
117 | bool def_hexpand, |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
118 | bool def_vexpand, |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
119 | bool def_hfill, |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
120 | bool def_vfill) |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
121 | { |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | this->current = NULL; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | this->grid = grid; |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
124 | this->def_hexpand = def_hexpand; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
125 | this->def_vexpand = def_vexpand; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
126 | this->def_hfill = def_hfill; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
127 | this->def_vfill = def_vfill; |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | grid->setContentsMargins(QMargins(margin, margin, margin, margin)); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | grid->setHorizontalSpacing(columnspacing); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | grid->setVerticalSpacing(rowspacing); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | ui_reset_layout(layout); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | |
|
108
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
134 | void UiGridContainer::add(QWidget* widget) { |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | if(layout.newline) { |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | x = 0; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | y++; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | |
|
108
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
140 | bool fill = layout.fill; |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
141 | bool hexpand = false; |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
142 | bool vexpand = false; |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
143 | bool hfill = false; |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
144 | bool vfill = false; |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
145 | if(!layout.override_defaults) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
146 | if(def_hexpand) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
147 | hexpand = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
148 | hfill = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
149 | } else if(def_hfill) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
150 | hfill = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
151 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
152 | if(def_vexpand) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
153 | vexpand = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
154 | vfill = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
155 | } else if(def_vfill) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
156 | vfill = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
157 | } |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
159 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
160 | if(layout.hexpand) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
161 | hexpand = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
162 | //hfill = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
163 | } else if(layout.hfill) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
164 | hfill = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
165 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
166 | if(layout.vexpand) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
167 | vexpand = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
168 | //vfill = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
169 | } else if(layout.vfill) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
170 | vfill = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
171 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
172 | if(fill) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
173 | hfill = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
174 | vfill = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
175 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
176 | |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
177 | if(hexpand) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
178 | col_expanding = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
179 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
180 | if(vexpand) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
181 | row_expanding = true; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
182 | } |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
183 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
184 | if(hexpand) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
185 | grid->setColumnStretch(x, 1); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
186 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
187 | if(vexpand) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
188 | grid->setRowStretch(y, 1); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
189 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
190 | |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
191 | Qt::Alignment alignment = 0; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
192 | if(!hfill) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
193 | alignment = Qt::AlignLeft; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
194 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
195 | if(!vfill) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
196 | alignment = Qt::AlignTop; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
197 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
198 | |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
199 | int colspan = layout.colspan > 0 ? layout.colspan : 1; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
200 | int rowspan = layout.rowspan > 0 ? layout.rowspan : 1; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
201 | |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
202 | grid->addWidget(widget, y, x, rowspan, colspan, alignment); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
203 | |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
204 | if(x > max_x) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
205 | max_x = x; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
206 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
207 | if(y > max_y) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
208 | max_y = y; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
209 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
210 | |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
211 | x += colspan; |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
212 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
213 | ui_reset_layout(layout); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
214 | current = widget; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
215 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
216 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
217 | void UiGridContainer::end() { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
218 | if(!col_expanding) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
219 | QSpacerItem *filler = new QSpacerItem(0, 0); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
220 | x = max_x + 1; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
221 | grid->setColumnStretch(x, 1); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
222 | grid->addItem(filler, 0, x, 1, 1, 0); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
223 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
224 | if(!row_expanding) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
225 | QSpacerItem *filler = new QSpacerItem(0, 0); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
226 | y++; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
227 | grid->setRowStretch(y, 1); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
228 | grid->addItem(filler, y, 0, 1, 1, 0); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
229 | } |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
230 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
231 | |
|
109
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
232 | UIWIDGET ui_grid_create(UiObject *obj, UiContainerArgs *args) { |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
233 | UiContainerPrivate *ctn = (UiContainerPrivate*)ui_obj_container(obj); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
234 | UI_APPLY_LAYOUT(ctn->layout, args); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
235 | |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
236 | QWidget *widget = new QWidget(); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
237 | QGridLayout *grid = new QGridLayout(); |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
238 | widget->setLayout(grid); |
|
108
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
239 | ctn->add(widget); |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
240 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
241 | ui_container_add(obj, new UiGridContainer( |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
242 | grid, |
|
108
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
243 | args->margin, |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
244 | args->columnspacing, |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
245 | args->rowspacing, |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
246 | args->def_hexpand, |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
247 | args->def_vexpand, |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
248 | args->def_hfill, |
|
77254bd6dccb
update toolkit, adjust UI code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
103
diff
changeset
|
249 | args->def_vfill)); |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
250 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
251 | return widget; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
252 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
253 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
254 | |
|
109
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
255 | /* ---------------------------- UiSidebar ---------------------------- */ |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
256 | |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
257 | UIWIDGET ui_sidebar_create(UiObject *obj, UiSidebarArgs *args) { |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
258 | QVariant v = obj->widget->property("ui_sidebar"); |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
259 | QDockWidget *dock = (QDockWidget*)v.value<void*>(); |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
260 | if(!dock) { |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
261 | fprintf(stderr, "Error: window is not configured for sidebar\n"); |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
262 | return nullptr; |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
263 | } |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
264 | |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
265 | QWidget *widget = new QWidget(); |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
266 | QBoxLayout *box = new QBoxLayout(QBoxLayout::TopToBottom); |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
267 | widget->setLayout(box); |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
268 | dock->setWidget(widget); |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
269 | |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
270 | ui_container_add(obj, new UiBoxContainer(box)); |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
271 | |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
272 | return dock; |
|
c3dfcb8f0be7
update toolkit, remove getvalue func from model to table/listview args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
108
diff
changeset
|
273 | } |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
274 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
275 | /* -------------------- Container Helper Functions -------------------- */ |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
276 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
277 | void ui_container_begin_close(UiObject *obj) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
278 | obj->container_end->close = true; |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
279 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
280 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
281 | int ui_container_finish(UiObject *obj) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
282 | if(obj->container_end->close) { |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
283 | UiContainerPrivate *ctn = (UiContainerPrivate*)obj->container_end->container; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
284 | ctn->end(); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
285 | ui_end_new(obj); |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
286 | return 0; |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
287 | } |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
288 | return 1; |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
289 | } |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
290 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
291 | |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
292 | /* |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
293 | * -------------------- Layout Functions -------------------- |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
294 | * |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
295 | * functions for setting layout attributes for the current container |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
296 | * |
|
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
297 | */ |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
298 | |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
299 | void ui_newline(UiObject *obj) { |
|
103
6606616eca9f
update uwproj, toolkit, libidav
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
0
diff
changeset
|
300 | UiContainerPrivate *ct = ui_obj_container(obj); |
|
0
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
301 | ct->layout.newline = TRUE; |
|
2483f517c562
add existing toolkit code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
302 | } |