ui/ui/window.h

Sun, 11 Feb 2024 15:44:33 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 11 Feb 2024 15:44:33 +0100
branch
newapi
changeset 252
7d176764756d
parent 250
d2068517fbdd
child 256
8874a68bafb0
permissions
-rw-r--r--

add input option to ui_dialog

0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
1 /*
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
3 *
140
c03c338a7dcf refactors value binding system
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 106
diff changeset
4 * Copyright 2017 Olaf Wintermann. All rights reserved.
0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
5 *
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
7 * modification, are permitted provided that the following conditions are met:
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
8 *
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
11 *
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
15 *
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
1f419bd32da1 added files
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
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
26 * POSSIBILITY OF SUCH DAMAGE.
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
27 */
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
28
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
29 #ifndef UI_WINDOW_H
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
30 #define UI_WINDOW_H
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
31
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
32 #include "toolkit.h"
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
33
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
34 #ifdef __cplusplus
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
35 extern "C" {
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
36 #endif
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
37
242
4ff7361dce95 add file open dialog (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
38 #define UI_FILEDIALOG_SELECT_SINGLE 0
4ff7361dce95 add file open dialog (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
39 #define UI_FILEDIALOG_SELECT_MULTI 1
4ff7361dce95 add file open dialog (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
40 #define UI_FILEDIALOG_SELECT_FOLDER 2
4ff7361dce95 add file open dialog (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
41
250
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
42 typedef struct UiDialogArgs {
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
43 const char *title;
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
44 const char *content;
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
45 const char *button1_label;
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
46 const char *button2_label;
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
47 const char *closebutton_label;
252
7d176764756d add input option to ui_dialog
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 250
diff changeset
48 UiBool input;
250
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
49 ui_callback result;
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
50 void *resultdata;
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
51 } UiDialogArgs;
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
52
201
7f67ebbb0c1c add UIEXPORT macro to create a dll
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 177
diff changeset
53 UIEXPORT UiObject* ui_window(const char *title, void *window_data);
244
33c0a3797a0d add function for creating windows without menu/toolbar (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 243
diff changeset
54 UIEXPORT UiObject* ui_simple_window(const char *title, void *window_data);
106
a4f4123ca12a added simple window and open/save file dialogs for Qt
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 28
diff changeset
55
241
c51dd0e9ecb7 add support for table string values, that need to be freed
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 201
diff changeset
56 UIEXPORT void ui_window_size(UiObject *obj, int width, int height);
c51dd0e9ecb7 add support for table string values, that need to be freed
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 201
diff changeset
57
250
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
58 #define ui_dialog(parent, ...) ui_dialog_create(parent, (UiDialogArgs){ __VA_ARGS__ } )
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
59
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
60 UIEXPORT void ui_dialog_create(UiObject *parent, UiDialogArgs args);
d2068517fbdd add function for creating dialogs (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 244
diff changeset
61
242
4ff7361dce95 add file open dialog (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
62 UIEXPORT void ui_openfiledialog(UiObject *obj, unsigned int mode, ui_callback file_selected_callback, void *cbdata);
4ff7361dce95 add file open dialog (WinUI3)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 241
diff changeset
63 UIEXPORT void ui_savefiledialog(UiObject *obj, unsigned int mode, ui_callback file_selected_callback, void *cbdata);
0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
64
243
9f66c31a27ed implement table dnd drop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 242
diff changeset
65
9f66c31a27ed implement table dnd drop
Olaf Wintermann <olaf.wintermann@gmail.com>
parents: 242
diff changeset
66
0
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
67 #ifdef __cplusplus
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
68 }
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
69 #endif
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
70
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
71 #endif /* WINDOW_H */
1f419bd32da1 added files
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff changeset
72

mercurial