Wed, 04 Dec 2024 18:31:22 +0100
add first code of the new Motif implementation, implement buttons
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 | * |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
4 | * Copyright 2024 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 | #include <stdio.h> |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #include <stdlib.h> |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
61
diff
changeset
|
31 | #include <inttypes.h> |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "container.h" |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | #include "../common/context.h" |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
35 | #include "../common/object.h" |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
37 | #include "Grid.h" |
60
7cd1b8890302
added vbox container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
59
diff
changeset
|
38 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
39 | UiContainerX* ui_box_container(UiObject *obj, Widget grid, UiBoxOrientation orientation) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
40 | UiBoxContainer *ctn = ui_malloc(obj->ctx, sizeof(UiBoxContainer)); |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
41 | memset(ctn, 0, sizeof(UiBoxContainer)); |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
42 | ctn->container.prepare = orientation == UI_BOX_VERTICAL ? ui_vbox_prepare : ui_hbox_prepare; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
43 | ctn->container.add = ui_box_container_add; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
44 | ctn->container.widget = grid; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
45 | ctn->n = 0; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
46 | return (UiContainerX*)ctn; |
62
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
61
diff
changeset
|
47 | } |
70d2aee84432
added grid container (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
61
diff
changeset
|
48 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
49 | static Widget ui_box_container_prepare(UiBoxContainer *box, Arg *args, int *n) { |
64
6ef2c7f73a30
added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
63
diff
changeset
|
50 | int a = *n; |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
51 | box->n++; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
52 | return box->container.widget; |
61
7ee124a58fe3
improved box (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
60
diff
changeset
|
53 | } |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
54 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
55 | Widget ui_vbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
56 | UiBoxContainer *box = (UiBoxContainer*)ctn; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
57 | int a = *n; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
58 | XtSetArg(args[a], gridRow, box->n); a++; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
59 | if(box->container.layout.fill == UI_ON) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
60 | XtSetArg(args[a], gridVExpand, TRUE); a++; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
61 | XtSetArg(args[a], gridVFill, TRUE); a++; |
64
6ef2c7f73a30
added simple tabview (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
63
diff
changeset
|
62 | } |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
63 | XtSetArg(args[a], gridHExpand, TRUE); a++; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
64 | XtSetArg(args[a], gridHFill, TRUE); a++; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
65 | *n = a; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
66 | return ui_box_container_prepare(box, args, n); |
91
c13e344fa55f
drawingarea based tab widget (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
76
diff
changeset
|
67 | } |
c13e344fa55f
drawingarea based tab widget (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
76
diff
changeset
|
68 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
69 | Widget ui_hbox_prepare(UiContainerPrivate *ctn, Arg *args, int *n) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
70 | UiBoxContainer *box = (UiBoxContainer*)ctn; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
71 | int a = *n; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
72 | XtSetArg(args[a], gridRow, box->n); a++; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
73 | if(box->container.layout.fill == UI_ON) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
74 | XtSetArg(args[a], gridHExpand, TRUE); a++; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
75 | } |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
76 | XtSetArg(args[a], gridVExpand, TRUE); a++; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
77 | *n = a; |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
78 | return ui_box_container_prepare(box, args, n); |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
79 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
80 | |
406
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
81 | void ui_box_container_add(UiContainerPrivate *ctn, Widget widget) { |
0ebf9d7b23e8
add first code of the new Motif implementation, implement buttons
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
253
diff
changeset
|
82 | ui_reset_layout(ctn->layout); |
91
c13e344fa55f
drawingarea based tab widget (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
76
diff
changeset
|
83 | |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
84 | } |