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