Tue, 29 Oct 2024 17:52:06 +0100
implement textfield onchange event (GTK)
145
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2017 Olaf Wintermann. All rights reserved. |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
853685152c1d
adds spinner widget (GTK)
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 |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #ifndef UI_ENTRY_H |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #define UI_ENTRY_H |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | #include "toolkit.h" |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | #ifdef __cplusplus |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | extern "C" { |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | #endif |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | |
264
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
38 | |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
39 | typedef struct UiSpinnerArgs { |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
40 | UiTri fill; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
41 | UiBool hexpand; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
42 | UiBool vexpand; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
43 | int colspan; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
44 | int rowspan; |
313
b679cc6059ab
add option to name widgets and add css classes (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
264
diff
changeset
|
45 | const char *name; |
b679cc6059ab
add option to name widgets and add css classes (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
264
diff
changeset
|
46 | const char *style_class; |
145
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | |
264
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
48 | double step; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
49 | int digits; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
50 | UiInteger *intvalue; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
51 | UiDouble* doublevalue; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
52 | UiRange *rangevalue; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
53 | const char* varname; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
54 | ui_callback onchange; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
55 | void* onchangedata; |
357
3f2a84587e4e
add groups to spinner args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
56 | |
3f2a84587e4e
add groups to spinner args
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
313
diff
changeset
|
57 | const int *groups; |
264
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
58 | } UiSpinnerArgs; |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
59 | |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
60 | |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
61 | |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
62 | UIWIDGET ui_spinner_create(UiObject *obj, UiSpinnerArgs args); |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
63 | |
24d9a92fd048
update spinner entry widget api (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
145
diff
changeset
|
64 | #define ui_spinner(obj, ...) ui_spinner_create(obj, (UiSpinnerArgs){ __VA_ARGS__ } ) |
145
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | void ui_spinner_setrange(UIWIDGET spinner, double min, double max); |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | void ui_spinner_setdigits(UIWIDGET spinner, int digits); |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | #ifdef __cplusplus |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | } |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | #endif |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | #endif /* UI_ENTRY_H */ |
853685152c1d
adds spinner widget (GTK)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 |