Fri, 13 Dec 2024 10:59:31 +0100
finish motif path bar implementation
0 | 1 | /* |
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | |
3 | * | |
144
29d98cff4f56
UiInteger uses int64 now
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
143
diff
changeset
|
4 | * Copyright 2017 Olaf Wintermann. All rights reserved. |
0 | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions are met: | |
8 | * | |
9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | |
11 | * | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * | |
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | |
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
26 | * POSSIBILITY OF SUCH DAMAGE. | |
27 | */ | |
28 | ||
29 | #include <stdio.h> | |
30 | #include <stdlib.h> | |
404
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
31 | #include <string.h> |
0 | 32 | |
33 | #include <ui/ui.h> | |
174 | 34 | #include <cx/buffer.h> |
35 | #include <cx/utils.h> | |
0 | 36 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
404
diff
changeset
|
37 | #if !defined(UI_COCOA) && !defined(UI_MOTIF) |
404
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
38 | |
163
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
39 | typedef struct { |
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
40 | UiString *str1; |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
41 | UiString *str2; |
282
3a77b9048664
add path textfield (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
279
diff
changeset
|
42 | UiString *path; |
335
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
43 | UiText *text; |
266
37d5b49b1c91
fix progressbar using the wrong var type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
265
diff
changeset
|
44 | UiDouble *progress; |
268
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
45 | UiList *list; |
390
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
46 | UiList *list2; |
311
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
47 | UiList *menulist; |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
48 | UiInteger *radio; |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
49 | UiInteger *tabview; |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
50 | UiGeneric *image; |
411
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
51 | UiList *srclist1; |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
52 | UiList *srclist2; |
163
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
53 | } MyDocument; |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
54 | |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
55 | MyDocument *doc1; |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
56 | MyDocument *doc2; |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
57 | |
333
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
58 | UIWIDGET tabview; |
163
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
59 | |
347
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
60 | static UiCondVar *cond; |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
61 | static int thr_end = 0; |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
62 | static int thr_started = 0; |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
63 | |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
64 | int threadfunc(void *data) { |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
65 | printf("thr wait for data...\n"); |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
66 | ui_condvar_wait(cond); |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
67 | printf("thr data received: {%s} [%d]\n", cond->data, cond->intdata); |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
68 | ui_condvar_destroy(cond); |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
69 | cond = NULL; |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
70 | |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
71 | return 0; |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
72 | } |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
73 | |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
74 | void action_start_thread(UiEvent *event, void *data) { |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
75 | if(!thr_started) { |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
76 | cond = ui_condvar_create(); |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
77 | ui_job(event->obj, threadfunc, NULL, NULL, NULL); |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
78 | thr_started = 1; |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
79 | } |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
80 | } |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
81 | |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
82 | void action_notify_thread(UiEvent *event, void *data) { |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
83 | if(!thr_end) { |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
84 | ui_condvar_signal(cond, "hello thread", 123); |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
85 | thr_end = 1; |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
86 | } |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
87 | } |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
88 | |
162 | 89 | void action_menu(UiEvent *event, void *userdata) { |
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
90 | |
145
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
144
diff
changeset
|
91 | } |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
144
diff
changeset
|
92 | |
279
2ad83650d797
implement file dialog (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
93 | void action_file_selected(UiEvent *event, void *userdata) { |
2ad83650d797
implement file dialog (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
94 | UiFileList *files = event->eventdata; |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
95 | MyDocument *doc = event->document; |
279
2ad83650d797
implement file dialog (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
96 | printf("files: %d\n", (int)files->nfiles); |
2ad83650d797
implement file dialog (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
97 | if(files->nfiles > 0) { |
2ad83650d797
implement file dialog (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
98 | printf("selected file: %s\n", files->files[0]); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
99 | ui_image_load_file(doc->image, files->files[0]); |
279
2ad83650d797
implement file dialog (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
100 | } |
2ad83650d797
implement file dialog (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
101 | } |
2ad83650d797
implement file dialog (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
278
diff
changeset
|
102 | |
163
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
103 | void action_button(UiEvent *event, void *userdata) { |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
104 | ui_openfiledialog(event->obj, UI_FILEDIALOG_SELECT_SINGLE, action_file_selected, NULL); |
163
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
105 | } |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
106 | |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
107 | void action_switch(UiEvent *event, void *userdata) { |
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
108 | |
163
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
109 | } |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
110 | |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
111 | void action_toolbar_button(UiEvent *event, void *userdata) { |
320
be224cf1f50e
add alternative ui_dialog implementation for libadwaita
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
317
diff
changeset
|
112 | printf("toolbar button\n"); |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
113 | |
320
be224cf1f50e
add alternative ui_dialog implementation for libadwaita
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
317
diff
changeset
|
114 | ui_dialog(event->obj, .title = "Dialog Title", .content = "Content Label", .button1_label = "btn1", .button2_label = "btn2", .input = TRUE, .closebutton_label = "Cancel"); |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
115 | } |
163
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
116 | |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
117 | void action_dialog_button(UiEvent *event, void *userdata) { |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
118 | ui_close(event->obj); |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
119 | } |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
120 | |
402
96a055be7f0b
add textfield onactivate event (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
121 | void action_dialog_onactivate(UiEvent *event, void *userdata) { |
96a055be7f0b
add textfield onactivate event (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
122 | printf("textfield activate\n"); |
96a055be7f0b
add textfield onactivate event (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
123 | ui_close(event->obj); |
96a055be7f0b
add textfield onactivate event (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
124 | } |
96a055be7f0b
add textfield onactivate event (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
125 | |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
126 | void action_toolbar_dialog(UiEvent *event, void *userdata) { |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
127 | |
345
d2ccc543f432
add style for dialog window default button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
344
diff
changeset
|
128 | UiObject *dialog = ui_dialog_window(event->obj, .title = "Dialog Window", .lbutton1 = "Cancel 1", .lbutton2 = "Btn2", .rbutton3 = "Btn3", .rbutton4 = "Login 4", .onclick = action_dialog_button, .default_button = 4, .show_closebutton = UI_OFF); |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
129 | |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
130 | ui_vbox(dialog, .margin = 10, .spacing = 10) { |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
131 | ui_label(dialog, .label = "Enter password:"); |
402
96a055be7f0b
add textfield onactivate event (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
390
diff
changeset
|
132 | ui_passwordfield(dialog, .varname = "password", .onactivate = action_dialog_onactivate); |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
133 | } |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
134 | |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
135 | ui_show(dialog); |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
136 | } |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
137 | |
336
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
138 | void action_toolbar_newwindow(UiEvent *event, void *userdata) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
139 | UiObject *obj = ui_simple_window("New Window", NULL); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
140 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
141 | ui_headerbar0(obj) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
142 | ui_headerbar_start(obj) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
143 | ui_button(obj, .label = "Open"); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
144 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
145 | ui_headerbar_end(obj) { |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
146 | ui_button(obj, .label = "Test"); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
147 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
148 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
149 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
150 | ui_textarea(obj, .varname="text"); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
151 | |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
152 | ui_show(obj); |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
153 | } |
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
154 | |
163
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
155 | MyDocument* create_doc(void) { |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
156 | MyDocument *doc = ui_document_new(sizeof(MyDocument)); |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
157 | UiContext *docctx = ui_document_context(doc); |
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
158 | doc->str1 = ui_string_new(docctx, "str1"); |
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
159 | doc->str1 = ui_string_new(docctx, "str2"); |
282
3a77b9048664
add path textfield (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
279
diff
changeset
|
160 | doc->path = ui_string_new(docctx, "path"); |
266
37d5b49b1c91
fix progressbar using the wrong var type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
265
diff
changeset
|
161 | doc->progress = ui_double_new(docctx, "progress"); |
268
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
162 | doc->list = ui_list_new(docctx, "list"); |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
163 | ui_list_append(doc->list, "test1"); |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
164 | ui_list_append(doc->list, "test2"); |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
165 | ui_list_append(doc->list, "test3"); |
390
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
166 | doc->list2 = ui_list_new(docctx, "list2"); |
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
167 | ui_list_append(doc->list2, "test1"); |
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
168 | ui_list_append(doc->list2, "test2"); |
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
169 | ui_list_append(doc->list2, "test3"); |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
170 | doc->radio = ui_int_new(docctx, "radio"); |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
171 | doc->tabview = ui_int_new(docctx, "tabview"); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
172 | doc->image = ui_generic_new(docctx, "image"); |
411
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
173 | |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
174 | doc->srclist1 = ui_list_new(docctx, "srclist1"); |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
175 | doc->srclist2 = ui_list_new(docctx, "srclist2"); |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
176 | ui_list_append(doc->srclist1, "test1"); |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
177 | ui_list_append(doc->srclist1, "test2"); |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
178 | ui_list_append(doc->srclist1, "test3"); |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
179 | ui_list_append(doc->srclist2, "x1"); |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
180 | ui_list_append(doc->srclist2, "x2"); |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
181 | |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
182 | |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
183 | |
335
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
184 | //doc->text = ui_text_new(docctx, "text"); |
163
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
185 | return doc; |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
186 | } |
b70e2a77dea0
refactore document system to support document trees
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
162
diff
changeset
|
187 | |
268
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
188 | UiIcon *icon = NULL; |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
189 | |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
190 | static void* list_getvalue(void *elm, int col) { |
269
3380100e20f5
implement listview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
268
diff
changeset
|
191 | /* |
268
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
192 | if(col == 0) { |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
193 | if(!icon) { |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
194 | icon = ui_icon("folder", 24); |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
195 | } |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
196 | return icon; |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
197 | } |
269
3380100e20f5
implement listview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
268
diff
changeset
|
198 | */ |
3380100e20f5
implement listview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
268
diff
changeset
|
199 | |
268
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
200 | char *str = elm; |
270
9389313ac00f
port combobox to new API (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
269
diff
changeset
|
201 | return col == 0 ? str : "x"; |
268
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
202 | } |
1b321a0c624f
port table to new API, replace custom tree model with GtkListStore
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
267
diff
changeset
|
203 | |
311
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
204 | static UiList *menu_list; |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
205 | int new_item_count = 0; |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
206 | |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
207 | void action_add_menu_item(UiEvent *event, void *userdata) { |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
208 | char str[64]; |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
209 | snprintf(str, 64, "new item %d", new_item_count++); |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
210 | |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
211 | ui_list_append(menu_list, strdup(str)); |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
212 | ui_list_notify(menu_list); |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
213 | } |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
214 | |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
215 | void action_menu_list(UiEvent *event, void *userdata) { |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
216 | printf("menu list item: %d\n", event->intval); |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
217 | } |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
218 | |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
219 | static int tab_x = 0; |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
220 | void action_tab2_button(UiEvent *event, void *userdata) { |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
221 | MyDocument *doc = event->document; |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
222 | printf("current page: %d\n", (int)ui_get(doc->tabview)); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
223 | ui_set(doc->tabview, 0); |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
224 | } |
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
225 | |
343
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
226 | |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
227 | void action_group1(UiEvent *event, void *userdata) { |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
228 | UiContext *ctx = event->obj->ctx; |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
229 | if(userdata) { |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
230 | ui_unset_group(ctx, 1); |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
231 | } else { |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
232 | ui_set_group(ctx, 1); |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
233 | } |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
234 | } |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
235 | |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
236 | void action_group2(UiEvent *event, void *userdata) { |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
237 | UiContext *ctx = event->obj->ctx; |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
238 | if(userdata) { |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
239 | ui_unset_group(ctx, 2); |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
240 | } else { |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
241 | ui_set_group(ctx, 2); |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
242 | } |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
243 | } |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
244 | |
383
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
245 | static UiObject *ref_window; |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
246 | |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
247 | void action_button_ref(UiEvent *event, void *userdata) { |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
248 | UiObject *obj = event->obj; |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
249 | printf("action_button_ref: %u\n", obj->ref); |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
250 | ui_object_ref(obj); |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
251 | ref_window = obj; |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
252 | } |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
253 | |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
254 | void action_button_unref(UiEvent *event, void *userdata) { |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
255 | UiObject *obj = userdata; |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
256 | printf("action_button_unref: %u\n", obj->ref); |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
257 | ui_object_unref(obj); |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
258 | } |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
259 | |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
260 | void action_toolbar_unrefwindow(UiEvent *event, void *userdata) { |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
261 | UiObject *obj = ui_simple_window("Unref", NULL); |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
262 | ui_grid(obj, .margin = 20) { |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
263 | ui_button(obj, .label = "Unref", .onclick = action_button_unref, .onclickdata = ref_window); |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
264 | } |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
265 | ui_show(obj); |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
266 | } |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
267 | |
411
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
268 | void action_sourcelist_activate(UiEvent *event, void *userdata) { |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
269 | printf("sourcelist %s index %d\n", event->eventdata, event->intval); |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
270 | } |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
271 | |
389
d15eca5fd8b3
implement image viewer context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
388
diff
changeset
|
272 | UiMenuBuilder *menubuilder; |
d15eca5fd8b3
implement image viewer context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
388
diff
changeset
|
273 | |
390
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
274 | void* table_getvalue(void *row, int col) { |
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
275 | return row; |
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
276 | } |
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
277 | |
411
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
278 | void sourcelist_getvalue(void *sublistdata, void *rowdata, int index, UiSubListItem *item) { |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
279 | item->label = strdup(rowdata); |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
280 | item->eventdata = sublistdata; |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
281 | } |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
282 | |
133
6dd780cbc8c6
using GtkApplication now
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
283 | void application_startup(UiEvent *event, void *data) { |
311
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
284 | // global list |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
285 | UiContext *global = ui_global_context(); |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
286 | menu_list = ui_list_new(global, "menulist"); |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
287 | ui_list_append(menu_list, "menu list item 1"); |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
288 | ui_list_append(menu_list, "menu list item 2"); |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
289 | ui_list_append(menu_list, "menu list item 3"); |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
290 | |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
291 | |
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
292 | |
409
86fbc80f0be7
add sidebar (libadwaita)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
408
diff
changeset
|
293 | UiObject *obj = ui_sidebar_window("Test", NULL); |
86fbc80f0be7
add sidebar (libadwaita)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
408
diff
changeset
|
294 | |
266
37d5b49b1c91
fix progressbar using the wrong var type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
265
diff
changeset
|
295 | MyDocument *doc = create_doc(); |
37d5b49b1c91
fix progressbar using the wrong var type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
265
diff
changeset
|
296 | ui_attach_document(obj->ctx, doc); |
37d5b49b1c91
fix progressbar using the wrong var type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
265
diff
changeset
|
297 | |
411
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
298 | ui_sidebar(obj, .margin = 0, .spacing = 0) { |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
299 | ui_sourcelist(obj, .fill = UI_ON, |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
300 | .getvalue = sourcelist_getvalue, |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
301 | .sublists = UI_SUBLISTS(UI_SUBLIST(.varname = "srclist1", .header = "Header 1", .userdata = "Sublist1"), UI_SUBLIST(.varname = "srclist2", .header = "Header 2", .userdata = "Sublist2")), |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
302 | .onactivate = action_sourcelist_activate); |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
303 | } |
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
304 | |
332
7e7c05af8f3a
implement stack set/get/remove (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
331
diff
changeset
|
305 | ui_tabview(obj, .spacing=10, .margin=10, .tabview = UI_TABVIEW_NAVIGATION_SIDE, .varname="tabview") { |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
306 | ui_tab(obj, "Tab 1") { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
307 | ui_vbox(obj, .fill = UI_OFF, .margin = 15, .spacing = 15) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
308 | ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
309 | ui_togglebutton(obj, .label = "Toggle"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
310 | ui_checkbox(obj, .label = "My Checkbox"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
311 | } |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
312 | ui_grid(obj, .fill = UI_OFF, .columnspacing = 15, .rowspacing = 15, .margin = 15) { |
343
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
313 | ui_button(obj, .label = "Activate Group 1", .hexpand = TRUE, .onclick = action_group1); |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
314 | ui_button(obj, .label = "Disable Group 1", .onclick = action_group1, .onclickdata = "disable"); |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
315 | ui_newline(obj); |
343
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
316 | ui_button(obj, .label = "Activate Group 2", .hexpand = TRUE, .onclick = action_group2); |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
317 | ui_button(obj, .label = "Disable Group 2", .onclick = action_group2, .onclickdata = "disable"); |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
318 | ui_newline(obj); |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
319 | |
54f5d7eb1335
implement widget groups for buttons (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
340
diff
changeset
|
320 | ui_button(obj, .label = "Groups 1,2", .colspan = 2, .groups = UI_GROUPS(1, 2)); |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
321 | ui_newline(obj); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
322 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
323 | ui_label(obj, .label = "Label Col 1", .align = UI_ALIGN_LEFT); |
358
98b26a19cbeb
add more label styles (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
354
diff
changeset
|
324 | ui_label(obj, .label = "Label Col 2", .style = UI_LABEL_STYLE_TITLE, .align = UI_ALIGN_RIGHT); |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
325 | ui_newline(obj); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
326 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
327 | ui_spinner(obj, .step = 5); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
328 | ui_newline(obj); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
329 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
330 | ui_progressbar(obj, .colspan = 2, .varname = "progress"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
331 | ui_set(doc->progress, 0.75); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
332 | ui_newline(obj); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
333 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
334 | ui_textfield(obj, .value = doc->str1); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
335 | ui_newline(obj); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
336 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
337 | //ui_button(obj, .label="Test"); |
411
3e91b7aff6a1
add sourcelist widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
409
diff
changeset
|
338 | ui_path_textfield(obj, .varname = "path", .hfill = TRUE, .hexpand = TRUE); |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
339 | ui_set(doc->path, "/test/path/longdirectoryname/123"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
340 | ui_newline(obj); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
341 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
342 | //UiModel *model = ui_model(obj->ctx, UI_ICON_TEXT, "Col 1", UI_STRING, "Col 2", -1); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
343 | //model->getvalue = list_getvalue; |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
344 | ui_combobox(obj, .hexpand = true, .vexpand = false, .colspan = 2, .varname = "list", .getvalue = list_getvalue); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
345 | ui_newline(obj); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
346 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
347 | ui_hbox0(obj) { |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
348 | ui_radiobutton(obj, .label = "Radio 1", .varname = "radio"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
349 | ui_radiobutton(obj, .label = "Radio 2", .varname = "radio"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
350 | ui_radiobutton(obj, .label = "Radio 3", .varname = "radio"); |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
351 | } |
390
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
352 | ui_newline(obj); |
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
353 | |
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
354 | UiModel *model = ui_model(obj->ctx, UI_STRING, "col1", -1); |
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
355 | model->getvalue = table_getvalue; |
b130f80ec7f9
implement list/table contextmenu (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
389
diff
changeset
|
356 | ui_table(obj, .model = model, .list = doc->list2, .colspan = 2, .hexpand = TRUE, .contextmenu = menubuilder); |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
357 | } |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
358 | } |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
359 | ui_tab(obj, "Tab 2") { |
347
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
360 | ui_button(obj, .label = "Button 1 Start Thread", .onclick=action_start_thread); |
6f0d0b0d97f5
add conditional variable API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
345
diff
changeset
|
361 | ui_button(obj, .label = "Button 2 Notify Thread", .onclick=action_notify_thread); |
383
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
362 | ui_button(obj, .label = "Obj Ref", .onclick=action_button_ref); |
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
363 | ui_button(obj, .label = "Obj Unref", .onclick=action_button_unref, .onclickdata = obj); |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
364 | ui_button(obj, .label = "Button 5", .onclick=action_tab2_button); |
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
365 | ui_button(obj, .label = "Button 6", .onclick=action_tab2_button); |
331
cdad8b7e83db
implement side navigation tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
328
diff
changeset
|
366 | } |
335
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
367 | ui_tab(obj, "Tab 3") { |
333
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
368 | UiTabViewArgs args = {0}; |
335
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
369 | UI_CTN(obj, tabview=ui_tabview_create(obj, args)) { |
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
370 | UiObject *tab1 = ui_tabview_add(tabview, "Sub 1", -1); |
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
371 | ui_button(tab1, .label = "Button 1"); |
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
372 | |
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
373 | |
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
374 | UiObject *tab2 = ui_tabview_add(tabview, "Sub 2", -1); |
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
375 | ui_button(tab2, .label = "Button 2"); |
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
376 | } |
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
377 | } |
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
378 | ui_tab(obj, "Tab 4") { |
91d4f0391282
add new textarea (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
333
diff
changeset
|
379 | ui_textarea(obj, .varname = "text"); |
333
634e3ce80afe
implement gtk3 stack tabview
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
332
diff
changeset
|
380 | } |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
381 | ui_tab(obj, "Tab 5") { |
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
382 | ui_button(obj, .label = "Test Button", .icon = "application-x-generic", .onclick = action_button); |
389
d15eca5fd8b3
implement image viewer context menus (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
388
diff
changeset
|
383 | ui_imageviewer(obj, .varname = "image", .style_class = "imageviewer", .contextmenu = menubuilder); |
339
b68b5f984074
add minimally working image viewer (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
336
diff
changeset
|
384 | } |
350
70305d427f25
fix ui_scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
347
diff
changeset
|
385 | |
70305d427f25
fix ui_scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
347
diff
changeset
|
386 | ui_tab(obj, "Tab 6") { |
354
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
352
diff
changeset
|
387 | ui_scrolledwindow(obj, .fill = UI_ON) { |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
352
diff
changeset
|
388 | ui_expander(obj, .label = "Expander", .margin = 10, .spacing = 10) { |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
352
diff
changeset
|
389 | ui_label(obj, .label = "Test"); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
352
diff
changeset
|
390 | ui_button(obj, .label = "Button"); |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
352
diff
changeset
|
391 | } |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
352
diff
changeset
|
392 | |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
352
diff
changeset
|
393 | ui_frame(obj, .label = "Frame", .margin = 10, .spacing = 10) { |
358
98b26a19cbeb
add more label styles (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
354
diff
changeset
|
394 | ui_label(obj, .label = "Title", .style = UI_LABEL_STYLE_TITLE); |
98b26a19cbeb
add more label styles (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
354
diff
changeset
|
395 | ui_label(obj, .label = "Sub-Title", .style = UI_LABEL_STYLE_SUBTITLE); |
98b26a19cbeb
add more label styles (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
354
diff
changeset
|
396 | ui_label(obj, .label = "Dim Label", .style = UI_LABEL_STYLE_DIM); |
98b26a19cbeb
add more label styles (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
354
diff
changeset
|
397 | ui_label(obj, .label = "No Style"); |
354
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
352
diff
changeset
|
398 | } |
baf9bcc98d87
add expander container (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
352
diff
changeset
|
399 | |
351
63db7e35e2e9
implement scrolledwindow sub container type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
350
diff
changeset
|
400 | for(int i=0;i<100;i++) { |
63db7e35e2e9
implement scrolledwindow sub container type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
350
diff
changeset
|
401 | char labelstr[32]; |
63db7e35e2e9
implement scrolledwindow sub container type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
350
diff
changeset
|
402 | snprintf(labelstr, 32, "button %d", i); |
63db7e35e2e9
implement scrolledwindow sub container type (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
350
diff
changeset
|
403 | ui_button(obj, .label = labelstr); |
350
70305d427f25
fix ui_scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
347
diff
changeset
|
404 | } |
70305d427f25
fix ui_scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
347
diff
changeset
|
405 | } |
70305d427f25
fix ui_scrolledwindow (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
347
diff
changeset
|
406 | } |
260
eebb0626d020
implement grid colspan/rowspan (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
407 | } |
eebb0626d020
implement grid colspan/rowspan (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
259
diff
changeset
|
408 | |
328
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
409 | /* |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
410 | |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
411 | */ |
059cba080ab4
implement new tabview (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
322
diff
changeset
|
412 | |
133
6dd780cbc8c6
using GtkApplication now
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
413 | ui_show(obj); |
95
29f5cd5f5367
added drawing area (Gtk)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
94
diff
changeset
|
414 | } |
111
40dbf1a7526a
added close handler to UiContext (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
110
diff
changeset
|
415 | |
29
c96169444d88
added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
28
diff
changeset
|
416 | int main(int argc, char** argv) { |
88
04c81be1c5a0
added textarea (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
417 | ui_init("app1", argc, argv); |
133
6dd780cbc8c6
using GtkApplication now
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
418 | ui_onstartup(application_startup, NULL); |
88
04c81be1c5a0
added textarea (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
419 | |
133
6dd780cbc8c6
using GtkApplication now
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
127
diff
changeset
|
420 | // menu |
255
ebdce2bb62be
minimal working menubar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
421 | ui_menu("File") { |
ebdce2bb62be
minimal working menubar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
422 | ui_menuitem(.label = "Test"); |
ebdce2bb62be
minimal working menubar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
423 | } |
253
087cc9216f28
initial newapi GTK port
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
174
diff
changeset
|
424 | |
388
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
425 | ui_contextmenu(&menubuilder) { |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
426 | ui_menuitem(.label = "Context Item 1"); |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
427 | ui_menuitem(.label = "Context Item 2"); |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
428 | ui_menu("Context Submenu") { |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
429 | ui_menuitem(.label = "Context Sub Item"); |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
430 | } |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
431 | } |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
432 | |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
433 | ui_menu("Edit") { |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
434 | ui_menuitem(.label = "Undo"); |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
435 | ui_menuseparator(); |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
436 | ui_menu("Submenu") { |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
437 | ui_menuitem(.label = "Subitem"); |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
438 | } |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
439 | } |
473c03f85197
add menu builder API
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
383
diff
changeset
|
440 | |
308
4efc7c19e31d
simplify gtk button code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
306
diff
changeset
|
441 | ui_toolbar_item("Test", .label = "Test", .onclick = action_toolbar_button); |
336
56c12f44c2d3
add custom headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
335
diff
changeset
|
442 | ui_toolbar_item("Test2", .label = "New Window", .onclick = action_toolbar_newwindow); |
344
870dd3d41d83
add dialog window (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
343
diff
changeset
|
443 | ui_toolbar_item("Test3", .label = "Dialog", .onclick = action_toolbar_dialog); |
383
03599608d555
add UiObject reference counting (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
358
diff
changeset
|
444 | ui_toolbar_item("Test4", .label = "Unref Window", .onclick = action_toolbar_unrefwindow); |
308
4efc7c19e31d
simplify gtk button code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
306
diff
changeset
|
445 | ui_toolbar_item("Test5", .label = "Test 5", .onclick = action_toolbar_button); |
4efc7c19e31d
simplify gtk button code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
306
diff
changeset
|
446 | ui_toolbar_item("Test6", .label = "Test 6", .onclick = action_toolbar_button); |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
447 | ui_toolbar_toggleitem("Toggle", .label = "Toggle", .onchange = action_toolbar_button); |
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
448 | ui_toolbar_menu("Menu", .label = "Menu") { |
311
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
449 | ui_menuitem("Secondary Test", .onclick = action_toolbar_button, NULL); |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
450 | ui_menu("Secondary Sub") { |
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
451 | ui_menuitem("Secondary subitem", NULL, NULL); |
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
452 | } |
322
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
453 | ui_menuseparator(); |
311
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
454 | ui_menu_itemlist(.varname = "menulist", .onselect=action_menu_list); |
322
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
455 | ui_menuseparator(); |
311
450a813dc2a5
implement GTK4 gmenu item and item list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
310
diff
changeset
|
456 | ui_menuitem("last", .onclick = action_add_menu_item); |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
457 | } |
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
458 | |
322
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
459 | ui_toolbar_appmenu() { |
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
460 | ui_menuitem("New"); |
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
461 | ui_menuitem("Open"); |
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
462 | ui_menuitem("Save"); |
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
463 | |
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
464 | ui_menuseparator(); |
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
465 | |
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
466 | ui_menuitem("Close"); |
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
467 | } |
22f6dadd9f46
implement ui_menuseparator (GTK4)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
320
diff
changeset
|
468 | |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
469 | ui_toolbar_add_default("Test", UI_TOOLBAR_LEFT); |
306
d02e1149cdb9
add headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
470 | ui_toolbar_add_default("Test6", UI_TOOLBAR_LEFT); |
275
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
471 | ui_toolbar_add_default("Toggle", UI_TOOLBAR_LEFT); |
132c7bcc6997
implement new toolbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
270
diff
changeset
|
472 | ui_toolbar_add_default("Menu", UI_TOOLBAR_LEFT); |
89
9a7e4a335b2b
added toolbar (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
88
diff
changeset
|
473 | |
306
d02e1149cdb9
add headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
474 | ui_toolbar_add_default("Test2", UI_TOOLBAR_CENTER); |
d02e1149cdb9
add headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
475 | ui_toolbar_add_default("Test3", UI_TOOLBAR_CENTER); |
d02e1149cdb9
add headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
476 | |
d02e1149cdb9
add headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
477 | ui_toolbar_add_default("Test4", UI_TOOLBAR_RIGHT); |
d02e1149cdb9
add headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
478 | ui_toolbar_add_default("Test5", UI_TOOLBAR_RIGHT); |
d02e1149cdb9
add headerbar (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
304
diff
changeset
|
479 | |
88
04c81be1c5a0
added textarea (WPF)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
86
diff
changeset
|
480 | ui_main(); |
29
c96169444d88
added locale support (Cocoa) and ucx update
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
28
diff
changeset
|
481 | |
0 | 482 | return (EXIT_SUCCESS); |
483 | } | |
404
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
484 | |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
485 | #endif |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
486 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
404
diff
changeset
|
487 | #if defined(UI_COCOA) || defined(UI_MOTIF) |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
404
diff
changeset
|
488 | |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
404
diff
changeset
|
489 | void action_button(UiEvent *event, void *data) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
404
diff
changeset
|
490 | printf("action_button\n"); |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
404
diff
changeset
|
491 | } |
404
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
492 | |
414
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
493 | typedef struct WData { |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
494 | UiString *path; |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
495 | } WData; |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
496 | |
404
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
497 | void application_startup(UiEvent *event, void *data) { |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
404
diff
changeset
|
498 | UiObject *obj = ui_window("Test", NULL); |
407
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
499 | |
414
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
500 | WData *wdata = ui_malloc(obj->ctx, sizeof(WData)); |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
501 | wdata->path = ui_string_new(obj->ctx, NULL); |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
502 | obj->window = wdata; |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
503 | |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
504 | /* |
407
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
505 | ui_grid(obj, .margin = 10) { |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
506 | ui_button(obj, .label = "Test Button", .onclick = action_button); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
507 | ui_newline(obj); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
508 | |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
509 | ui_togglebutton(obj, .label = "Togglebutton"); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
510 | ui_togglebutton(obj, .label = "XY", .hfill = TRUE); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
511 | ui_togglebutton(obj, .label = "AB", .hfill = TRUE); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
512 | ui_togglebutton(obj, .label = "ZZ", .hexpand = TRUE, .hfill = TRUE); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
513 | ui_newline(obj); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
514 | |
408
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
515 | ui_hbox(obj, .colspan = 4, .hfill = TRUE, .hexpand = TRUE) { |
407
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
516 | ui_checkbox(obj, .label = "Checkbox", .enable_group = 123); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
517 | ui_checkbox(obj, .label = "Checkbox Disabled", .groups = UI_GROUPS(123)); |
408
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
518 | ui_button(obj, .label = "fill", .fill = UI_ON); |
407
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
519 | } |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
520 | ui_newline(obj); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
521 | |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
522 | |
408
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
523 | |
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
524 | ui_hbox(obj, .colspan = 4, .hfill = TRUE, .hexpand = TRUE) { |
407
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
525 | ui_radiobutton(obj, .label = "Radio 1", .varname = "radio"); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
526 | ui_radiobutton(obj, .label = "Radio 2", .varname = "radio"); |
408
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
527 | ui_button(obj, .label = "fill", .hexpand = TRUE, .hfill = TRUE); |
407
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
528 | } |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
529 | ui_newline(obj); |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
530 | |
408
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
531 | |
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
532 | ui_hbox(obj, .colspan = 4, .vexpand = TRUE, .vfill = TRUE) { |
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
533 | ui_button(obj, .label = "F1----------------------A"); |
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
534 | ui_button(obj, .label = "F2 test test test test test test test"); |
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
535 | ui_button(obj, .label = "F312343543"); |
407
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
536 | } |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
537 | |
408
b06e43f1edd4
fix grid colspan/rowspan
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
407
diff
changeset
|
538 | |
407
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
539 | } |
414
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
540 | */ |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
541 | |
407
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
542 | |
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
543 | |
414
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
544 | //ui_textfield(obj, .varname = "textfield"); |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
545 | //ui_textfield(obj, .varname = "textfield2"); |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
546 | ui_path_textfield(obj, .value = wdata->path, .hfill = TRUE, .hexpand = TRUE); |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
547 | |
ef60d527c066
add text field widgets (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
411
diff
changeset
|
548 | ui_set(wdata->path, "/test/path/string"); |
407
8ea123dd89db
semi functional grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
406
diff
changeset
|
549 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
404
diff
changeset
|
550 | |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
404
diff
changeset
|
551 | ui_show(obj); |
404
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
552 | } |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
553 | |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
554 | int main(int argc, char** argv) { |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
555 | ui_init("app1", argc, argv); |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
556 | ui_onstartup(application_startup, NULL); |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
557 | ui_main(); |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
558 | return (EXIT_SUCCESS); |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
559 | } |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
560 | |
384f6d1f5784
add first working cocoa code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
402
diff
changeset
|
561 | #endif |