ui/ui/button.h

Fri, 13 Oct 2023 19:53:21 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 13 Oct 2023 19:53:21 +0200
branch
newapi
changeset 216
391c2c723029
parent 201
7f67ebbb0c1c
child 230
4f5b32a2a60f
permissions
-rw-r--r--

add dll icon loader

4
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
140
c03c338a7dcf refactors value binding system
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 108
diff changeset
4 * Copyright 2017 Olaf Wintermann. All rights reserved.
4
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #ifndef UI_BUTTON_H
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #define UI_BUTTON_H
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #include "toolkit.h"
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 #ifdef __cplusplus
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 extern "C" {
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #endif
186
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
37
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
38 typedef struct UiButtonArgs {
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
39 UiTri fill;
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
40 UiBool hexpand;
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
41 UiBool vexpand;
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
42 int colspan;
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
43 int rowspan;
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
44
187
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
45 const char* label;
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
46 const char* stockid;
186
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
47 ui_callback onclick;
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
48 void* onclickdata;
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
49 } UiButtonArgs;
4
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
50
186
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
51 typedef struct UiToggleArgs {
187
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
52 UiTri fill;
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
53 UiBool hexpand;
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
54 UiBool vexpand;
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
55 int colspan;
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
56 int rowspan;
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
57
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
58 const char* label;
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
59 const char* stockid;
186
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
60 UiInteger* value;
187
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
61 const char* varname;
189
4daddc326877 add onchange event for toggle buttons (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 188
diff changeset
62 ui_callback onchange;
4daddc326877 add onchange event for toggle buttons (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 188
diff changeset
63 void* onchangedata;
186
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
64 } UiToggleArgs;
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
65
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
66 #define ui_button(obj, ...) ui_button_create(obj, (UiButtonArgs){ __VA_ARGS__ } )
187
24ce2c326d85 implement toggle button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 186
diff changeset
67 #define ui_togglebutton(obj, ...) ui_togglebutton_create(obj, (UiToggleArgs){ __VA_ARGS__ } )
186
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
68 #define ui_checkbox(obj, ...) ui_checkbox_create(obj, (UiToggleArgs){ __VA_ARGS__ } )
191
6113ed66d258 add toggle switch (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 189
diff changeset
69 #define ui_switch(obj, ...) ui_switch_create(obj, (UiToggleArgs){ __VA_ARGS__ } )
188
fbbae6738252 implement radio button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 187
diff changeset
70 #define ui_radiobutton(obj, ...) ui_radiobutton_create(obj, (UiToggleArgs){ __VA_ARGS__ } )
94
d51e334c1439 added checkbox and labels with alignment (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 4
diff changeset
71
201
7f67ebbb0c1c add UIEXPORT macro to create a dll
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 191
diff changeset
72 UIEXPORT UIWIDGET ui_button_create(UiObject* obj, UiButtonArgs args);
7f67ebbb0c1c add UIEXPORT macro to create a dll
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 191
diff changeset
73 UIEXPORT UIWIDGET ui_togglebutton_create(UiObject* obj, UiToggleArgs args);
7f67ebbb0c1c add UIEXPORT macro to create a dll
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 191
diff changeset
74 UIEXPORT UIWIDGET ui_checkbox_create(UiObject* obj, UiToggleArgs args);
7f67ebbb0c1c add UIEXPORT macro to create a dll
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 191
diff changeset
75 UIEXPORT UIWIDGET ui_switch_create(UiObject* obj, UiToggleArgs args);
7f67ebbb0c1c add UIEXPORT macro to create a dll
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 191
diff changeset
76 UIEXPORT UIWIDGET ui_radiobutton_create(UiObject* obj, UiToggleArgs args);
186
5db4979bf482 implement new api style for ui_button (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 142
diff changeset
77
107
9aff1dc3990d improved box container and added radio button (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 94
diff changeset
78
4
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
79
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
80 #ifdef __cplusplus
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
81 }
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
82 #endif
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
83
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
84 #endif /* UI_BUTTON_H */
39b9b86ec452 added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
85

mercurial