Wed, 30 Oct 2024 15:32:38 +0100
fix condvar windows implementation
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
140
c03c338a7dcf
refactors value binding system
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
121
diff
changeset
|
4 | * Copyright 2017 Olaf Wintermann. All rights reserved. |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
39b9b86ec452
added simple container
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 |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #include <stdio.h> |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #include <stdlib.h> |
165
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
31 | #include <limits.h> |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "container.h" |
165
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
34 | #include "toolkit.h" |
336
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
35 | #include "headerbar.h" |
165
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
36 | |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | #include "../common/context.h" |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
38 | #include "../common/object.h" |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
39 | |
166
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
40 | |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
41 | void ui_container_begin_close(UiObject *obj) { |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
42 | UiContainer *ct = uic_get_current_container(obj); |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
43 | ct->close = 1; |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
44 | } |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
45 | |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
46 | int ui_container_finish(UiObject *obj) { |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
47 | UiContainer *ct = uic_get_current_container(obj); |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
48 | if(ct->close) { |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
49 | ui_end(obj); |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
50 | return 0; |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
51 | } |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
52 | return 1; |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
53 | } |
6e48030cf2db
add container macros (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
165
diff
changeset
|
54 | |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
55 | GtkWidget* ui_gtk_vbox_new(int spacing) { |
297
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
56 | #if GTK_MAJOR_VERSION >= 3 |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
57 | return gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing); |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
58 | #else |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
59 | return gtk_vbox_new(FALSE, spacing); |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
60 | #endif |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
61 | } |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
62 | |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
63 | GtkWidget* ui_gtk_hbox_new(int spacing) { |
297
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
64 | #if GTK_MAJOR_VERSION >= 3 |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
65 | return gtk_box_new(GTK_ORIENTATION_HORIZONTAL, spacing); |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
66 | #else |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
67 | return gtk_hbox_new(FALSE, spacing); |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
68 | #endif |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
69 | } |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
70 | |
353
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
71 | GtkWidget* ui_subcontainer_create( |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
72 | UiSubContainerType type, |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
73 | UiObject *newobj, |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
74 | int spacing, |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
75 | int columnspacing, |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
76 | int rowspacing, |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
77 | int margin) |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
78 | { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
79 | GtkWidget *sub = NULL; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
80 | GtkWidget *add = NULL; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
81 | switch(type) { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
82 | default: { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
83 | sub = ui_gtk_vbox_new(spacing); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
84 | add = ui_box_set_margin(sub, margin); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
85 | newobj->container = ui_box_container(newobj, sub, type); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
86 | newobj->widget = sub; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
87 | break; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
88 | } |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
89 | case UI_CONTAINER_HBOX: { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
90 | sub = ui_gtk_hbox_new(spacing); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
91 | add = ui_box_set_margin(sub, margin); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
92 | newobj->container = ui_box_container(newobj, sub, type); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
93 | newobj->widget = sub; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
94 | break; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
95 | } |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
96 | case UI_CONTAINER_GRID: { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
97 | sub = ui_create_grid_widget(columnspacing, rowspacing); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
98 | add = ui_box_set_margin(sub, margin); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
99 | newobj->container = ui_grid_container(newobj, sub); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
100 | newobj->widget = sub; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
101 | break; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
102 | } |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
103 | case UI_CONTAINER_NO_SUB: { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
104 | break; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
105 | } |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
106 | } |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
107 | return add; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
108 | } |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
109 | |
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
110 | |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
111 | /* -------------------- Box Container -------------------- */ |
297
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
112 | UiContainer* ui_box_container(UiObject *obj, GtkWidget *box, UiSubContainerType type) { |
174 | 113 | UiBoxContainer *ct = cxCalloc( |
114 | obj->ctx->allocator, | |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
115 | 1, |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
116 | sizeof(UiBoxContainer)); |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
117 | ct->container.widget = box; |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
118 | ct->container.add = ui_box_container_add; |
297
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
119 | ct->type = type; |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
120 | return (UiContainer*)ct; |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
121 | } |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
122 | |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
123 | void ui_box_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
124 | UiBoxContainer *bc = (UiBoxContainer*)ct; |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
125 | if(ct->layout.fill != UI_LAYOUT_UNDEFINED) { |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
126 | fill = ui_lb2bool(ct->layout.fill); |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
127 | } |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
128 | |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
129 | if(bc->has_fill && fill) { |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
130 | fprintf(stderr, "UiError: container has 2 filled widgets"); |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
131 | fill = FALSE; |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
132 | } |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
133 | if(fill) { |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
134 | bc->has_fill = TRUE; |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
135 | } |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
136 | |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
137 | UiBool expand = fill; |
297
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
138 | #if GTK_MAJOR_VERSION >= 4 |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
139 | gtk_box_append(GTK_BOX(ct->widget), widget); |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
140 | GtkAlign align = expand ? GTK_ALIGN_FILL : GTK_ALIGN_START; |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
141 | if(bc->type == UI_CONTAINER_VBOX) { |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
142 | gtk_widget_set_valign(widget, align); |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
143 | gtk_widget_set_vexpand(widget, expand); |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
144 | gtk_widget_set_hexpand(widget, TRUE); |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
145 | } else if(bc->type == UI_CONTAINER_HBOX) { |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
146 | gtk_widget_set_halign(widget, align); |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
147 | gtk_widget_set_hexpand(widget, expand); |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
148 | gtk_widget_set_vexpand(widget, TRUE); |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
149 | } |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
150 | |
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
151 | #else |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
152 | gtk_box_pack_start(GTK_BOX(ct->widget), widget, expand, fill, 0); |
297
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
153 | #endif |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
154 | |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
155 | ui_reset_layout(ct->layout); |
75
efe2f65bea17
added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
74
diff
changeset
|
156 | ct->current = widget; |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
157 | } |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
158 | |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
159 | UiContainer* ui_grid_container(UiObject *obj, GtkWidget *grid) { |
174 | 160 | UiGridContainer *ct = cxCalloc( |
161 | obj->ctx->allocator, | |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
162 | 1, |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
163 | sizeof(UiGridContainer)); |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
164 | ct->container.widget = grid; |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
165 | ct->container.add = ui_grid_container_add; |
305
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
166 | UI_GTK_V2(ct->width = 0); |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
167 | UI_GTK_V2(ct->height = 1); |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
168 | return (UiContainer*)ct; |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
169 | } |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
170 | |
297
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
171 | #if GTK_MAJOR_VERSION >= 3 |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
172 | void ui_grid_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
173 | UiGridContainer *grid = (UiGridContainer*)ct; |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
174 | |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
175 | if(ct->layout.newline) { |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
176 | grid->x = 0; |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
177 | grid->y++; |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
178 | ct->layout.newline = FALSE; |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
179 | } |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
180 | |
99
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
181 | int hexpand = FALSE; |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
182 | int vexpand = FALSE; |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
183 | if(ct->layout.hexpand != UI_LAYOUT_UNDEFINED) { |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
184 | hexpand = ct->layout.hexpand; |
94
d51e334c1439
added checkbox and labels with alignment (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
75
diff
changeset
|
185 | } |
99
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
186 | if(ct->layout.vexpand != UI_LAYOUT_UNDEFINED) { |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
187 | vexpand = ct->layout.vexpand; |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
188 | } |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
189 | |
303
dc8b504604f4
fix gtk3/4 grid hexpand/vexpand setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
298
diff
changeset
|
190 | gtk_widget_set_hexpand(widget, hexpand); |
dc8b504604f4
fix gtk3/4 grid hexpand/vexpand setting
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
298
diff
changeset
|
191 | gtk_widget_set_vexpand(widget, vexpand); |
94
d51e334c1439
added checkbox and labels with alignment (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
75
diff
changeset
|
192 | |
260
eebb0626d020
implement grid colspan/rowspan (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
193 | int colspan = ct->layout.colspan > 0 ? ct->layout.colspan : 1; |
eebb0626d020
implement grid colspan/rowspan (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
194 | int rowspan = ct->layout.rowspan > 0 ? ct->layout.rowspan : 1; |
109
b9808f916687
added gridwidth layout option (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
107
diff
changeset
|
195 | |
260
eebb0626d020
implement grid colspan/rowspan (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
196 | gtk_grid_attach(GTK_GRID(ct->widget), widget, grid->x, grid->y, colspan, rowspan); |
eebb0626d020
implement grid colspan/rowspan (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
197 | grid->x += colspan; |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
198 | |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
199 | ui_reset_layout(ct->layout); |
75
efe2f65bea17
added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
74
diff
changeset
|
200 | ct->current = widget; |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
201 | } |
74
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
202 | #endif |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
203 | #ifdef UI_GTK2 |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
204 | void ui_grid_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
205 | UiGridContainer *grid = (UiGridContainer*)ct; |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
206 | |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
207 | if(ct->layout.newline) { |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
208 | grid->x = 0; |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
209 | grid->y++; |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
210 | ct->layout.newline = FALSE; |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
211 | } |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
212 | |
100
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
213 | int hexpand = FALSE; |
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
214 | int vexpand = FALSE; |
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
215 | if(ct->layout.hexpand != UI_LAYOUT_UNDEFINED) { |
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
216 | hexpand = ct->layout.hexpand; |
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
217 | } |
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
218 | if(ct->layout.vexpand != UI_LAYOUT_UNDEFINED) { |
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
219 | vexpand = ct->layout.vexpand; |
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
220 | } |
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
221 | GtkAttachOptions xoptions = hexpand ? GTK_FILL | GTK_EXPAND : GTK_FILL; |
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
222 | GtkAttachOptions yoptions = vexpand ? GTK_FILL | GTK_EXPAND : GTK_FILL; |
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
223 | |
260
eebb0626d020
implement grid colspan/rowspan (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
224 | int colspan = ct->layout.colspan > 0 ? ct->layout.colspan : 1; |
eebb0626d020
implement grid colspan/rowspan (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
225 | int rowspan = ct->layout.rowspan > 0 ? ct->layout.rowspan : 1; |
eebb0626d020
implement grid colspan/rowspan (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
226 | // TODO: use colspan/rowspan |
eebb0626d020
implement grid colspan/rowspan (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
227 | |
100
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
228 | gtk_table_attach(GTK_TABLE(ct->widget), widget, grid->x, grid->x+1, grid->y, grid->y+1, xoptions, yoptions, 0, 0); |
74
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
229 | grid->x++; |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
230 | int nw = grid->x > grid->width ? grid->x : grid->width; |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
231 | if(grid->x > grid->width || grid->y > grid->height) { |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
232 | grid->width = nw; |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
233 | grid->height = grid->y + 1; |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
234 | gtk_table_resize(GTK_TABLE(ct->widget), grid->width, grid->height); |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
235 | } |
75
efe2f65bea17
added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
74
diff
changeset
|
236 | |
efe2f65bea17
added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
74
diff
changeset
|
237 | ui_reset_layout(ct->layout); |
efe2f65bea17
added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
74
diff
changeset
|
238 | ct->current = widget; |
74
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
239 | } |
55718d4ed227
fixed grid container when using gtk2
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
66
diff
changeset
|
240 | #endif |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
241 | |
353
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
242 | UiContainer* ui_frame_container(UiObject *obj, GtkWidget *frame) { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
243 | UiContainer *ct = cxCalloc( |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
244 | obj->ctx->allocator, |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
245 | 1, |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
246 | sizeof(UiContainer)); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
247 | ct->widget = frame; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
248 | ct->add = ui_frame_container_add; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
249 | return ct; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
250 | } |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
251 | |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
252 | void ui_frame_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
253 | FRAME_SET_CHILD(ct->widget, widget); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
254 | } |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
255 | |
354
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
256 | UiContainer* ui_expander_container(UiObject *obj, GtkWidget *expander) { |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
257 | UiContainer *ct = cxCalloc( |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
258 | obj->ctx->allocator, |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
259 | 1, |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
260 | sizeof(UiContainer)); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
261 | ct->widget = expander; |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
262 | ct->add = ui_expander_container_add; |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
263 | return ct; |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
264 | } |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
265 | |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
266 | void ui_expander_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
267 | EXPANDER_SET_CHILD(ct->widget, widget); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
268 | } |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
269 | |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
270 | void ui_scrolledwindow_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
271 | // TODO: check if the widget implements GtkScrollable |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
272 | SCROLLEDWINDOW_SET_CHILD(ct->widget, widget); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
273 | ui_reset_layout(ct->layout); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
274 | ct->current = widget; |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
275 | } |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
276 | |
120
49bc645df8b7
added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
116
diff
changeset
|
277 | UiContainer* ui_scrolledwindow_container(UiObject *obj, GtkWidget *scrolledwindow) { |
174 | 278 | UiContainer *ct = cxCalloc( |
279 | obj->ctx->allocator, | |
120
49bc645df8b7
added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
116
diff
changeset
|
280 | 1, |
49bc645df8b7
added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
116
diff
changeset
|
281 | sizeof(UiContainer)); |
49bc645df8b7
added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
116
diff
changeset
|
282 | ct->widget = scrolledwindow; |
49bc645df8b7
added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
116
diff
changeset
|
283 | ct->add = ui_scrolledwindow_container_add; |
49bc645df8b7
added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
116
diff
changeset
|
284 | return ct; |
49bc645df8b7
added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
116
diff
changeset
|
285 | } |
49bc645df8b7
added scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
116
diff
changeset
|
286 | |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
287 | UiContainer* ui_tabview_container(UiObject *obj, GtkWidget *tabview) { |
174 | 288 | UiTabViewContainer *ct = cxCalloc( |
289 | obj->ctx->allocator, | |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
290 | 1, |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
291 | sizeof(UiTabViewContainer)); |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
292 | ct->container.widget = tabview; |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
293 | ct->container.add = ui_tabview_container_add; |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
294 | return (UiContainer*)ct; |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
295 | } |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
296 | |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
297 | void ui_tabview_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
298 | UiGtkTabView *data = ui_widget_get_tabview_data(ct->widget); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
299 | if(!data) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
300 | fprintf(stderr, "UI Error: widget is not a tabview"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
301 | return; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
302 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
303 | data->add_tab(ct->widget, -1, ct->layout.label, widget); |
75
efe2f65bea17
added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
74
diff
changeset
|
304 | |
efe2f65bea17
added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
74
diff
changeset
|
305 | ui_reset_layout(ct->layout); |
efe2f65bea17
added context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
74
diff
changeset
|
306 | ct->current = widget; |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
307 | } |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
308 | |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
309 | |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
310 | |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
311 | GtkWidget* ui_box_set_margin(GtkWidget *box, int margin) { |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
312 | GtkWidget *ret = box; |
304
d554b2a60105
fix gtk box margin
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
303
diff
changeset
|
313 | #if GTK_MAJOR_VERSION >= 3 |
d554b2a60105
fix gtk box margin
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
303
diff
changeset
|
314 | #if GTK_MAJOR_VERSION * 1000 + GTK_MINOR_VERSION >= 3012 |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
315 | gtk_widget_set_margin_start(box, margin); |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
316 | gtk_widget_set_margin_end(box, margin); |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
317 | #else |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
318 | gtk_widget_set_margin_left(box, margin); |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
319 | gtk_widget_set_margin_right(box, margin); |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
320 | #endif |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
321 | gtk_widget_set_margin_top(box, margin); |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
322 | gtk_widget_set_margin_bottom(box, margin); |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
323 | #elif defined(UI_GTK2) |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
324 | GtkWidget *a = gtk_alignment_new(0.5, 0.5, 1, 1); |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
325 | gtk_alignment_set_padding(GTK_ALIGNMENT(a), margin, margin, margin, margin); |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
326 | gtk_container_add(GTK_CONTAINER(a), box); |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
327 | ret = a; |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
328 | #endif |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
329 | return ret; |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
330 | } |
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
331 | |
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
332 | UIWIDGET ui_box_create(UiObject *obj, UiContainerArgs args, UiSubContainerType type) { |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
333 | UiObject *current = uic_current_obj(obj); |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
334 | UiContainer *ct = current->container; |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
335 | UI_APPLY_LAYOUT1(current, args); |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
336 | |
273 | 337 | GtkWidget *box = type == UI_CONTAINER_VBOX ? ui_gtk_vbox_new(args.spacing) : ui_gtk_hbox_new(args.spacing); |
313
b679cc6059ab
add option to name widgets and add css classes (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
305
diff
changeset
|
338 | ui_set_name_and_style(box, args.name, args.style_class); |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
339 | GtkWidget *widget = args.margin > 0 ? ui_box_set_margin(box, args.margin) : box; |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
340 | ct->add(ct, widget, TRUE); |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
341 | |
273 | 342 | UiObject *newobj = uic_object_new(obj, box); |
297
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
343 | newobj->container = ui_box_container(obj, box, type); |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
344 | uic_obj_add(obj, newobj); |
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
345 | |
107
9aff1dc3990d
improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
100
diff
changeset
|
346 | return widget; |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
347 | } |
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
348 | |
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
349 | UIEXPORT UIWIDGET ui_vbox_create(UiObject *obj, UiContainerArgs args) { |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
350 | return ui_box_create(obj, args, UI_CONTAINER_VBOX); |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
351 | } |
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
352 | |
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
353 | UIEXPORT UIWIDGET ui_hbox_create(UiObject *obj, UiContainerArgs args) { |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
354 | return ui_box_create(obj, args, UI_CONTAINER_HBOX); |
94
d51e334c1439
added checkbox and labels with alignment (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
75
diff
changeset
|
355 | } |
d51e334c1439
added checkbox and labels with alignment (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
75
diff
changeset
|
356 | |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
357 | GtkWidget* ui_create_grid_widget(int colspacing, int rowspacing) { |
305
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
358 | #if GTK_MAJOR_VERSION >= 3 |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
359 | GtkWidget *grid = gtk_grid_new(); |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
360 | gtk_grid_set_column_spacing(GTK_GRID(grid), colspacing); |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
361 | gtk_grid_set_row_spacing(GTK_GRID(grid), rowspacing); |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
362 | #else |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
363 | GtkWidget *grid = gtk_table_new(1, 1, FALSE); |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
364 | gtk_table_set_col_spacings(GTK_TABLE(grid), colspacing); |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
365 | gtk_table_set_row_spacings(GTK_TABLE(grid), rowspacing); |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
366 | #endif |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
367 | return grid; |
98470af75dcf
simplfy macro usage in container.c (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
368 | } |
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
369 | |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
370 | UIWIDGET ui_grid_create(UiObject *obj, UiContainerArgs args) { |
271
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
371 | UiObject* current = uic_current_obj(obj); |
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
372 | UI_APPLY_LAYOUT1(current, args); |
100
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
373 | GtkWidget *widget; |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
374 | |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
375 | GtkWidget *grid = ui_create_grid_widget(args.columnspacing, args.rowspacing); |
313
b679cc6059ab
add option to name widgets and add css classes (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
305
diff
changeset
|
376 | ui_set_name_and_style(grid, args.name, args.style_class); |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
377 | widget = ui_box_set_margin(grid, args.margin); |
271
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
378 | current->container->add(current->container, widget, TRUE); |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
379 | |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
380 | UiObject *newobj = uic_object_new(obj, grid); |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
381 | newobj->container = ui_grid_container(obj, grid); |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
382 | uic_obj_add(obj, newobj); |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
383 | |
100
d276306d801f
improved gtk2 implementation of grid container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
99
diff
changeset
|
384 | return widget; |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
385 | } |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
386 | |
353
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
387 | UIWIDGET ui_frame_create(UiObject *obj, UiFrameArgs args) { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
388 | UiObject* current = uic_current_obj(obj); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
389 | UI_APPLY_LAYOUT1(current, args); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
390 | |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
391 | GtkWidget *frame = gtk_frame_new(args.label); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
392 | UiObject *newobj = uic_object_new(obj, frame); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
393 | GtkWidget *sub = ui_subcontainer_create(args.subcontainer, newobj, args.spacing, args.columnspacing, args.rowspacing, args.margin); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
394 | if(sub) { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
395 | FRAME_SET_CHILD(frame, sub); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
396 | } else { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
397 | newobj->widget = frame; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
398 | newobj->container = ui_frame_container(obj, frame); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
399 | } |
354
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
400 | current->container->add(current->container, frame, FALSE); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
401 | uic_obj_add(obj, newobj); |
353
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
402 | |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
403 | return frame; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
404 | } |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
405 | |
354
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
406 | UIEXPORT UIWIDGET ui_expander_create(UiObject *obj, UiFrameArgs args) { |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
407 | UiObject* current = uic_current_obj(obj); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
408 | UI_APPLY_LAYOUT1(current, args); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
409 | |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
410 | GtkWidget *expander = gtk_expander_new(args.label); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
411 | gtk_expander_set_expanded(GTK_EXPANDER(expander), args.isexpanded); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
412 | UiObject *newobj = uic_object_new(obj, expander); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
413 | GtkWidget *sub = ui_subcontainer_create(args.subcontainer, newobj, args.spacing, args.columnspacing, args.rowspacing, args.margin); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
414 | if(sub) { |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
415 | EXPANDER_SET_CHILD(expander, sub); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
416 | } else { |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
417 | newobj->widget = expander; |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
418 | newobj->container = ui_expander_container(obj, expander); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
419 | } |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
420 | current->container->add(current->container, expander, FALSE); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
421 | uic_obj_add(obj, newobj); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
422 | |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
423 | return expander; |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
424 | } |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
353
diff
changeset
|
425 | |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
426 | |
271
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
427 | UIWIDGET ui_scrolledwindow_create(UiObject* obj, UiFrameArgs args) { |
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
428 | UiObject* current = uic_current_obj(obj); |
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
429 | UI_APPLY_LAYOUT1(current, args); |
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
430 | |
297
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
431 | GtkWidget *sw = SCROLLEDWINDOW_NEW(); |
313
b679cc6059ab
add option to name widgets and add css classes (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
305
diff
changeset
|
432 | ui_set_name_and_style(sw, args.name, args.style_class); |
350
70305d427f25
fix ui_scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
344
diff
changeset
|
433 | GtkWidget *widget = ui_box_set_margin(sw, args.margin); |
70305d427f25
fix ui_scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
344
diff
changeset
|
434 | current->container->add(current->container, widget, TRUE); |
70305d427f25
fix ui_scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
344
diff
changeset
|
435 | |
271
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
436 | UiObject *newobj = uic_object_new(obj, sw); |
353
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
437 | GtkWidget *sub = ui_subcontainer_create(args.subcontainer, newobj, args.spacing, args.columnspacing, args.rowspacing, args.margin); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
438 | if(sub) { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
439 | SCROLLEDWINDOW_SET_CHILD(sw, sub); |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
440 | } else { |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
441 | newobj->widget = sw; |
ae999e3346a9
add frame container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
351
diff
changeset
|
442 | newobj->container = ui_scrolledwindow_container(obj, sw); |
351
63db7e35e2e9
implement scrolledwindow sub container type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
350
diff
changeset
|
443 | } |
63db7e35e2e9
implement scrolledwindow sub container type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
350
diff
changeset
|
444 | |
271
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
445 | uic_obj_add(obj, newobj); |
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
446 | |
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
447 | return sw; |
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
448 | } |
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
449 | |
94d44bdcad3e
add new scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
450 | |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
451 | void ui_notebook_tab_select(UIWIDGET tabview, int tab) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
452 | gtk_notebook_set_current_page(GTK_NOTEBOOK(tabview), tab); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
453 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
454 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
455 | void ui_notebook_tab_remove(UIWIDGET tabview, int tab) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
456 | gtk_notebook_remove_page(GTK_NOTEBOOK(tabview), tab); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
457 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
458 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
459 | void ui_notebook_tab_add(UIWIDGET widget, int index, const char *name, UIWIDGET child) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
460 | gtk_notebook_insert_page( |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
461 | GTK_NOTEBOOK(widget), |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
462 | child, |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
463 | gtk_label_new(name), |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
464 | index); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
465 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
466 | |
330
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
467 | int64_t ui_notebook_get(UiInteger *i) { |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
468 | GtkNotebook *nb = i->obj; |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
469 | i->value = gtk_notebook_get_current_page(nb); |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
470 | return i->value; |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
471 | } |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
472 | |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
473 | void ui_notebook_set(UiInteger *i, int64_t value) { |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
474 | GtkNotebook *nb = i->obj; |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
475 | gtk_notebook_set_current_page(nb, value); |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
476 | i->value = gtk_notebook_get_current_page(nb); |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
477 | } |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
478 | |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
479 | |
333
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
480 | #if GTK_MAJOR_VERSION >= 4 |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
481 | static int stack_set_page(GtkWidget *stack, int index) { |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
482 | GtkSelectionModel *pages = gtk_stack_get_pages(GTK_STACK(stack)); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
483 | GListModel *list = G_LIST_MODEL(pages); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
484 | GtkStackPage *page = g_list_model_get_item(list, index); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
485 | if(page) { |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
486 | gtk_stack_set_visible_child(GTK_STACK(stack), gtk_stack_page_get_child(page)); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
487 | } else { |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
488 | fprintf(stderr, "UI Error: ui_stack_set value out of bounds\n"); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
489 | return -1; |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
490 | } |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
491 | return index; |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
492 | } |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
493 | |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
494 | void ui_stack_tab_select(UIWIDGET tabview, int tab) { |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
495 | stack_set_page(tabview, tab); |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
496 | } |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
497 | |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
498 | void ui_stack_tab_remove(UIWIDGET tabview, int tab) { |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
499 | GtkStack *stack = GTK_STACK(tabview); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
500 | GtkWidget *current = gtk_stack_get_visible_child(stack); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
501 | GtkSelectionModel *pages = gtk_stack_get_pages(stack); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
502 | GListModel *list = G_LIST_MODEL(pages); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
503 | GtkStackPage *page = g_list_model_get_item(list, tab); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
504 | if(page) { |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
505 | gtk_stack_remove(stack, gtk_stack_page_get_child(page)); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
506 | } |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
507 | } |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
508 | |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
509 | void ui_stack_tab_add(UIWIDGET widget, int index, const char *name, UIWIDGET child) { |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
510 | (void)gtk_stack_add_titled(GTK_STACK(widget), child, name, name); |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
511 | } |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
512 | |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
513 | int64_t ui_stack_get(UiInteger *i) { |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
514 | GtkStack *stack = GTK_STACK(i->obj); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
515 | GtkWidget *current = gtk_stack_get_visible_child(stack); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
516 | GtkSelectionModel *pages = gtk_stack_get_pages(stack); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
517 | GListModel *list = G_LIST_MODEL(pages); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
518 | int nitems = g_list_model_get_n_items(list); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
519 | for(int p=0;p<nitems;p++) { |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
520 | GtkStackPage *page = g_list_model_get_item(list, p); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
521 | GtkWidget *child = gtk_stack_page_get_child(page); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
522 | if(child == current) { |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
523 | i->value = p; |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
524 | break; |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
525 | } |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
526 | } |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
527 | return i->value; |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
528 | } |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
529 | |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
530 | void ui_stack_set(UiInteger *i, int64_t value) { |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
531 | GtkWidget *widget = i->obj; |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
532 | if(stack_set_page(widget, value) >= 0) { |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
533 | i->value = value; |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
534 | } |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
535 | } |
333
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
536 | #elif GTK_MAJOR_VERSION >= 3 |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
537 | static GtkWidget* stack_get_child(GtkWidget *stack, int index) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
538 | GList *children = gtk_container_get_children(GTK_CONTAINER(stack)); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
539 | if(children) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
540 | return g_list_nth_data(children, index); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
541 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
542 | return NULL; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
543 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
544 | |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
545 | void ui_stack_tab_select(UIWIDGET tabview, int tab) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
546 | GtkWidget *child = stack_get_child(tabview, tab); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
547 | if(child) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
548 | gtk_stack_set_visible_child(GTK_STACK(tabview), child); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
549 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
550 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
551 | |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
552 | void ui_stack_tab_remove(UIWIDGET tabview, int tab) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
553 | GtkWidget *child = stack_get_child(tabview, tab); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
554 | if(child) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
555 | gtk_container_remove(GTK_CONTAINER(tabview), child); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
556 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
557 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
558 | |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
559 | void ui_stack_tab_add(UIWIDGET widget, int index, const char *name, UIWIDGET child) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
560 | gtk_stack_add_titled(GTK_STACK(widget), child, name, name); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
561 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
562 | |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
563 | int64_t ui_stack_get(UiInteger *i) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
564 | GtkWidget *visible = gtk_stack_get_visible_child(GTK_STACK(i->obj)); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
565 | GList *children = gtk_container_get_children(GTK_CONTAINER(i->obj)); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
566 | GList *elm = children; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
567 | int n = 0; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
568 | int64_t v = -1; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
569 | while(elm) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
570 | GtkWidget *child = elm->data; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
571 | if(child == visible) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
572 | v = n; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
573 | break; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
574 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
575 | |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
576 | elm = elm->next; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
577 | n++; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
578 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
579 | g_list_free(children); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
580 | i->value = v; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
581 | return v; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
582 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
583 | |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
584 | void ui_stack_set(UiInteger *i, int64_t value) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
585 | GtkWidget *child = stack_get_child(i->obj, value); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
586 | if(child) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
587 | gtk_stack_set_visible_child(GTK_STACK(i->obj), child); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
588 | i->value = value; |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
589 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
590 | } |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
591 | |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
592 | #endif |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
593 | |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
594 | |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
595 | |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
596 | |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
597 | UiGtkTabView* ui_widget_get_tabview_data(UIWIDGET tabview) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
598 | return g_object_get_data(G_OBJECT(tabview), "ui_tabview"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
599 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
600 | |
330
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
601 | typedef int64_t(*ui_tabview_get_func)(UiInteger*); |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
602 | typedef void (*ui_tabview_set_func)(UiInteger*, int64_t); |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
603 | |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
604 | UIWIDGET ui_tabview_create(UiObject* obj, UiTabViewArgs args) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
605 | UiGtkTabView *data = malloc(sizeof(UiGtkTabView)); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
606 | data->margin = args.margin; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
607 | data->spacing = args.spacing; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
608 | data->columnspacing = args.columnspacing; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
609 | data->rowspacing = args.rowspacing; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
610 | |
330
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
611 | ui_tabview_get_func getfunc = NULL; |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
612 | ui_tabview_set_func setfunc = NULL; |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
613 | |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
614 | GtkWidget *widget = NULL; |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
615 | GtkWidget *data_widget = NULL; |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
616 | switch(args.tabview) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
617 | case UI_TABVIEW_DOC: { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
618 | // TODO |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
619 | break; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
620 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
621 | case UI_TABVIEW_NAVIGATION_SIDE: { |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
622 | #if GTK_CHECK_VERSION(3, 10, 0) |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
623 | widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
624 | GtkWidget *sidebar = gtk_stack_sidebar_new(); |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
625 | BOX_ADD(widget, sidebar); |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
626 | GtkWidget *stack = gtk_stack_new(); |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
627 | gtk_stack_set_transition_type (GTK_STACK(stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN); |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
628 | gtk_stack_sidebar_set_stack(GTK_STACK_SIDEBAR(sidebar), GTK_STACK(stack)); |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
629 | BOX_ADD_EXPAND(widget, stack); |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
630 | data->select_tab = ui_stack_tab_select; |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
631 | data->remove_tab = ui_stack_tab_remove; |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
632 | data->add_tab = ui_stack_tab_add; |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
633 | getfunc = ui_stack_get; |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
634 | setfunc = ui_stack_set; |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
635 | data_widget = stack; |
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
636 | #else |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
637 | // TODO |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
638 | #endif |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
639 | break; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
640 | } |
330
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
641 | case UI_TABVIEW_DEFAULT: /* fall through */ |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
642 | case UI_TABVIEW_NAVIGATION_TOP: /* fall through */ |
333
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
643 | case UI_TABVIEW_INVISIBLE: /* fall through */ |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
644 | case UI_TABVIEW_NAVIGATION_TOP2: { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
645 | widget = gtk_notebook_new(); |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
646 | data_widget = widget; |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
647 | data->select_tab = ui_notebook_tab_select; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
648 | data->remove_tab = ui_notebook_tab_remove; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
649 | data->add_tab = ui_notebook_tab_add; |
330
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
650 | getfunc = ui_notebook_get; |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
651 | setfunc = ui_notebook_set; |
333
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
652 | if(args.tabview == UI_TABVIEW_INVISIBLE) { |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
653 | gtk_notebook_set_show_tabs(GTK_NOTEBOOK(widget), FALSE); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
654 | gtk_notebook_set_show_border(GTK_NOTEBOOK(widget), FALSE); |
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
655 | } |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
656 | break; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
657 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
658 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
659 | |
330
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
660 | UiObject* current = uic_current_obj(obj); |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
661 | if(args.value || args.varname) { |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
662 | UiVar *var = uic_widget_var(obj->ctx, current->ctx, args.value, args.varname, UI_VAR_INTEGER); |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
663 | UiInteger *i = var->value; |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
664 | i->get = getfunc; |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
665 | i->set = setfunc; |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
666 | i->obj = data_widget; |
330
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
667 | } |
d615aa36c98e
add tabview value/varname parameter
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
668 | |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
669 | g_object_set_data(G_OBJECT(widget), "ui_tabview", data); |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
670 | data->widget = data_widget; |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
671 | data->subcontainer = args.subcontainer; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
672 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
673 | UI_APPLY_LAYOUT1(current, args); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
674 | current->container->add(current->container, widget, TRUE); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
675 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
676 | UiObject *newobj = uic_object_new(obj, widget); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
677 | newobj->container = ui_tabview_container(obj, widget); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
678 | uic_obj_add(obj, newobj); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
679 | data->obj = newobj; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
680 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
681 | return widget; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
682 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
683 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
684 | void ui_tab_create(UiObject* obj, const char* title) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
685 | UiObject* current = uic_current_obj(obj); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
686 | UiGtkTabView *data = ui_widget_get_tabview_data(current->widget); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
687 | if(!data) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
688 | fprintf(stderr, "UI Error: widget is not a tabview\n"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
689 | return; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
690 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
691 | |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
330
diff
changeset
|
692 | UiObject *newobj = ui_tabview_add(current->widget, title, -1); |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
693 | current->next = newobj; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
694 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
695 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
696 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
697 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
698 | void ui_tabview_select(UIWIDGET tabview, int tab) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
699 | UiGtkTabView *data = ui_widget_get_tabview_data(tabview); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
700 | if(!data) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
701 | fprintf(stderr, "UI Error: widget is not a tabview\n"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
702 | return; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
703 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
704 | data->select_tab(tabview, tab); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
705 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
706 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
707 | void ui_tabview_remove(UIWIDGET tabview, int tab) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
708 | UiGtkTabView *data = ui_widget_get_tabview_data(tabview); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
709 | if(!data) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
710 | fprintf(stderr, "UI Error: widget is not a tabview\n"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
711 | return; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
712 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
713 | data->remove_tab(tabview, tab); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
714 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
715 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
716 | UiObject* ui_tabview_add(UIWIDGET tabview, const char *name, int tab_index) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
717 | UiGtkTabView *data = ui_widget_get_tabview_data(tabview); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
718 | if(!data) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
719 | fprintf(stderr, "UI Error: widget is not a tabview\n"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
720 | return NULL; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
721 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
722 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
723 | UiObject *newobj = cxCalloc(data->obj->ctx->allocator, 1, sizeof(UiObject)); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
724 | newobj->ctx = data->obj->ctx; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
725 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
726 | GtkWidget *sub; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
727 | switch(data->subcontainer) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
728 | default: { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
729 | sub = ui_gtk_vbox_new(data->spacing); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
730 | newobj->container = ui_box_container(newobj, sub, data->subcontainer); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
731 | break; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
732 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
733 | case UI_CONTAINER_HBOX: { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
734 | sub = ui_gtk_hbox_new(data->spacing); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
735 | newobj->container = ui_box_container(newobj, sub, data->subcontainer); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
736 | break; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
737 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
738 | case UI_CONTAINER_GRID: { |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
739 | sub = ui_create_grid_widget(data->columnspacing, data->rowspacing); |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
740 | newobj->container = ui_grid_container(newobj, sub); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
741 | break; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
742 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
743 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
744 | newobj->widget = sub; |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
745 | GtkWidget *widget = ui_box_set_margin(sub, data->margin); |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
746 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
747 | data->add_tab(data->widget, tab_index, name, widget); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
748 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
749 | return newobj; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
750 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
751 | |
336
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
752 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
753 | /* -------------------- Headerbar -------------------- */ |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
754 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
755 | static void hb_set_part(UiObject *obj, int part) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
756 | UiObject* current = uic_current_obj(obj); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
757 | GtkWidget *headerbar = current->widget; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
758 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
759 | UiHeaderbarContainer *hb = cxCalloc( |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
760 | obj->ctx->allocator, |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
761 | 1, |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
762 | sizeof(UiHeaderbarContainer)); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
763 | memcpy(hb, current->container, sizeof(UiHeaderbarContainer)); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
764 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
765 | UiObject *newobj = uic_object_new(obj, headerbar); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
766 | newobj->container = (UiContainer*)hb; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
767 | uic_obj_add(obj, newobj); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
768 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
769 | hb->part = part; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
770 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
771 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
772 | void ui_headerbar_start_create(UiObject *obj) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
773 | hb_set_part(obj, 0); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
774 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
775 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
776 | void ui_headerbar_center_create(UiObject *obj) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
777 | hb_set_part(obj, 2); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
778 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
779 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
780 | void ui_headerbar_end_create(UiObject *obj) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
781 | hb_set_part(obj, 1); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
782 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
783 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
784 | UIWIDGET ui_headerbar_fallback_create(UiObject *obj, UiHeaderbarArgs args) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
785 | UiObject *current = uic_current_obj(obj); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
786 | UiContainer *ct = current->container; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
787 | UI_APPLY_LAYOUT1(current, args); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
788 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
789 | GtkWidget *box = ui_gtk_hbox_new(args.alt_spacing); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
790 | ui_set_name_and_style(box, args.name, args.style_class); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
791 | ct->add(ct, box, FALSE); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
792 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
793 | UiObject *newobj = uic_object_new(obj, box); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
794 | newobj->container = ui_headerbar_fallback_container(obj, box); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
795 | uic_obj_add(obj, newobj); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
796 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
797 | return box; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
798 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
799 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
800 | static void hb_fallback_set_part(UiObject *obj, int part) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
801 | UiObject* current = uic_current_obj(obj); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
802 | GtkWidget *headerbar = current->widget; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
803 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
804 | UiObject *newobj = uic_object_new(obj, headerbar); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
805 | newobj->container = ui_headerbar_container(obj, headerbar); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
806 | uic_obj_add(obj, newobj); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
807 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
808 | UiHeaderbarContainer *hb = (UiHeaderbarContainer*)newobj->container; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
809 | hb->part = part; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
810 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
811 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
812 | UiContainer* ui_headerbar_fallback_container(UiObject *obj, GtkWidget *headerbar) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
813 | UiHeaderbarContainer *ct = cxCalloc( |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
814 | obj->ctx->allocator, |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
815 | 1, |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
816 | sizeof(UiHeaderbarContainer)); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
817 | ct->container.widget = headerbar; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
818 | ct->container.add = ui_headerbar_fallback_container_add; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
819 | return (UiContainer*)ct; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
820 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
821 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
822 | void ui_headerbar_fallback_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
823 | UiHeaderbarContainer *hb = (UiHeaderbarContainer*)ct; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
824 | BOX_ADD(ct->widget, widget); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
825 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
826 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
827 | #if GTK_CHECK_VERSION(3, 10, 0) |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
828 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
829 | UIWIDGET ui_headerbar_create(UiObject *obj, UiHeaderbarArgs args) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
830 | GtkWidget *headerbar = g_object_get_data(G_OBJECT(obj->widget), "ui_headerbar"); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
831 | if(!headerbar) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
832 | return ui_headerbar_fallback_create(obj, args); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
833 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
834 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
835 | UiObject *newobj = uic_object_new(obj, headerbar); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
836 | newobj->container = ui_headerbar_container(obj, headerbar); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
837 | uic_obj_add(obj, newobj); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
838 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
839 | return headerbar; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
840 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
841 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
842 | UiContainer* ui_headerbar_container(UiObject *obj, GtkWidget *headerbar) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
843 | UiHeaderbarContainer *ct = cxCalloc( |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
844 | obj->ctx->allocator, |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
845 | 1, |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
846 | sizeof(UiHeaderbarContainer)); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
847 | ct->container.widget = headerbar; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
848 | ct->container.add = ui_headerbar_container_add; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
849 | return (UiContainer*)ct; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
850 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
851 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
852 | void ui_headerbar_container_add(UiContainer *ct, GtkWidget *widget, UiBool fill) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
853 | UiHeaderbarContainer *hb = (UiHeaderbarContainer*)ct; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
854 | if(hb->part == 0) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
855 | UI_HEADERBAR_PACK_START(ct->widget, widget); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
856 | } else if(hb->part == 1) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
857 | UI_HEADERBAR_PACK_END(ct->widget, widget); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
858 | } else if(hb->part == 2) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
859 | if(!hb->centerbox) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
860 | GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
861 | hb->centerbox = box; |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
862 | UI_HEADERBAR_SET_TITLE_WIDGET(ct->widget, box); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
863 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
864 | BOX_ADD(hb->centerbox, widget); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
865 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
866 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
867 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
868 | #else |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
869 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
870 | UIWIDGET ui_headerbar_create(UiObject *obj, UiHeaderbarArgs args) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
871 | return ui_headerbar_fallback_create(obj, args); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
872 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
873 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
874 | #endif |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
875 | |
165
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
876 | /* -------------------- Splitpane -------------------- */ |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
877 | |
165
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
878 | static GtkWidget* create_paned(UiOrientation orientation) { |
297
a73c60adf188
port container to gtk4
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
273
diff
changeset
|
879 | #if GTK_MAJOR_VERSION >= 3 |
165
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
880 | switch(orientation) { |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
881 | case UI_HORIZONTAL: return gtk_paned_new(GTK_ORIENTATION_HORIZONTAL); |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
882 | case UI_VERTICAL: return gtk_paned_new(GTK_ORIENTATION_VERTICAL); |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
883 | } |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
884 | #else |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
885 | switch(orientation) { |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
886 | case UI_HORIZONTAL: return gtk_hpaned_new(); |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
887 | case UI_VERTICAL: return gtk_vpaned_new(); |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
888 | } |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
889 | #endif |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
890 | return NULL; |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
891 | } |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
892 | |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
893 | |
3f32db79a76e
add splitpane (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
163
diff
changeset
|
894 | |
33
458831c574f4
added listview, sidebar and toolbar image button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
895 | |
59
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
896 | |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
897 | |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
898 | /* |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
899 | * -------------------- Layout Functions -------------------- |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
900 | * |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
901 | * functions for setting layout attributes for the current container |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
902 | * |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
903 | */ |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
904 | |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
905 | void ui_layout_fill(UiObject *obj, UiBool fill) { |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
906 | UiContainer *ct = uic_get_current_container(obj); |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
907 | ct->layout.fill = ui_bool2lb(fill); |
eb6611be50c7
added box container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
908 | } |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
909 | |
99
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
910 | void ui_layout_hexpand(UiObject *obj, UiBool expand) { |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
911 | UiContainer *ct = uic_get_current_container(obj); |
111
40dbf1a7526a
added close handler to UiContext (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
912 | ct->layout.hexpand = expand; |
99
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
913 | } |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
914 | |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
915 | void ui_layout_vexpand(UiObject *obj, UiBool expand) { |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
916 | UiContainer *ct = uic_get_current_container(obj); |
111
40dbf1a7526a
added close handler to UiContext (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
917 | ct->layout.vexpand = expand; |
99
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
918 | } |
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
919 | |
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
920 | void ui_layout_colspan(UiObject* obj, int cols) { |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
921 | UiContainer* ct = uic_get_current_container(obj); |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
922 | ct->layout.colspan = cols; |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
923 | } |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
924 | |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
925 | void ui_layout_rowspan(UiObject* obj, int rows) { |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
926 | UiContainer* ct = uic_get_current_container(obj); |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
927 | ct->layout.rowspan = rows; |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
928 | } |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
929 | |
65
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
930 | void ui_newline(UiObject *obj) { |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
931 | UiContainer *ct = uic_get_current_container(obj); |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
932 | ct->layout.newline = TRUE; |
4697592e24ba
added label, grid container, simple tabview and textfield (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
62
diff
changeset
|
933 | } |
99
ea1a2d5de765
improved grid container (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
934 |