Mon, 25 Aug 2014 17:27:29 +0200
added toolbar (Qt)
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 | * |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2014 Olaf Wintermann. All rights reserved. |
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> |
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 "container.h" |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "../common/context.h" |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
34 | #include "../common/object.h" |
4
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | UiContainer* ui_frame_container(UiObject *obj, Widget frame) { |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | UiContainer *ct = ucx_mempool_malloc( |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | obj->ctx->mempool, |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | sizeof(UiContainer)); |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | ct->widget = frame; |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | ct->add = ui_frame_container_add; |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | return ct; |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | } |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | Widget ui_frame_container_add(UiContainer *ct, Arg *args, int *n) { |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | return ct->widget; |
39b9b86ec452
added simple container
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | } |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
48 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
49 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
50 | UIWIDGET ui_sidebar(UiObject *obj) { |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
51 | UiContainer *ct = uic_get_current_container(obj); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
52 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
53 | Arg args[8]; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
54 | int n = 0; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
55 | XtSetArg(args[n], XmNorientation, XmHORIZONTAL); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
56 | n++; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
57 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
58 | Widget parent = ct->add(ct, args, &n); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
59 | Widget pane = XmCreatePanedWindow(parent, "pane", args, n); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
60 | XtManageChild(pane); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
61 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
62 | // add sidebar widget |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
63 | XtSetArg(args[0], XmNshadowType, XmSHADOW_ETCHED_OUT); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
64 | XtSetArg(args[1], XmNshadowThickness, 0); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
65 | Widget sidebar = XmCreateFrame(pane, "sidebar", args, 2); |
36
e4198fc2ead4
fixed list, text and added ui_close (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
34
diff
changeset
|
66 | XtManageChild(sidebar); |
34
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
67 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
68 | UiObject *left = uic_object_new(obj, sidebar); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
69 | left->container = ui_frame_container(left, sidebar); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
70 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
71 | // add content widget |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
72 | XtSetArg (args[2], XmNpaneMaximum, 8000); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
73 | Widget content = XmCreateFrame(pane, "content_area", args, 3); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
74 | XtManageChild(content); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
75 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
76 | UiObject *right = uic_object_new(obj, content); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
77 | right->container = ui_frame_container(right, content); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
78 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
79 | uic_obj_add(obj, right); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
80 | uic_obj_add(obj, left); |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
81 | |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
82 | return sidebar; |
0ec8a5f17782
added listview and sidebar (Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
4
diff
changeset
|
83 | } |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
84 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
85 | UiTabbedPane* ui_tabbed_document_view(UiObject *obj) { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
86 | int n = 0; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
87 | Arg args[16]; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
88 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
89 | UiContainer *ct = uic_get_current_container(obj); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
90 | Widget parent = ct->add(ct, args, &n); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
91 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
92 | Widget tabview = XmCreateForm(parent, "tabview_form", args, n); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
93 | XtManageChild(tabview); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
94 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
95 | XtSetArg(args[0], XmNorientation, XmHORIZONTAL); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
96 | XtSetArg(args[1], XmNpacking, XmPACK_TIGHT); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
97 | XtSetArg(args[2], XmNspacing, 1); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
98 | XtSetArg(args[3], XmNleftAttachment, XmATTACH_FORM); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
99 | XtSetArg(args[4], XmNrightAttachment, XmATTACH_FORM); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
100 | XtSetArg(args[5], XmNtopAttachment, XmATTACH_FORM); |
53
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
101 | Widget tabbar = XmCreateForm(tabview, "toolbar", args, 6); |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
102 | XtManageChild(tabbar); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
103 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
104 | XtSetArg(args[0], XmNleftAttachment, XmATTACH_FORM); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
105 | XtSetArg(args[1], XmNrightAttachment, XmATTACH_FORM); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
106 | XtSetArg(args[2], XmNtopAttachment, XmATTACH_WIDGET); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
107 | XtSetArg(args[3], XmNtopWidget, tabbar); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
108 | XtSetArg(args[4], XmNbottomAttachment, XmATTACH_FORM); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
109 | XtSetArg(args[5], XmNshadowThickness, 0); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
110 | Widget tabct = XmCreateForm(tabview, "tabview", args, 6); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
111 | XtManageChild(tabct); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
112 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
113 | MotifTabbedPane *tabbedpane = ui_malloc(obj->ctx, sizeof(MotifTabbedPane)); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
114 | tabbedpane->view.ctx = uic_current_obj(obj)->ctx; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
115 | tabbedpane->view.widget = tabct; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
116 | tabbedpane->view.document = NULL; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
117 | tabbedpane->tabbar = tabbar; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
118 | //tabbedpane->form = tabview; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
119 | tabbedpane->tabs = NULL; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
120 | tabbedpane->current = NULL; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
121 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
122 | return &tabbedpane->view; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
123 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
124 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
125 | UiObject* ui_document_tab(UiTabbedPane *view) { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
126 | MotifTabbedPane *v = (MotifTabbedPane*)view; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
127 | int n = 0; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
128 | Arg args[16]; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
129 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
130 | // hide the current tab content |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
131 | if(v->current) { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
132 | XtUnmanageChild(v->current->content->widget); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
133 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
134 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
135 | UiTab *tab = ui_malloc(view->ctx, sizeof(UiTab)); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
136 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
137 | // create the new tab content |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
138 | XtSetArg(args[0], XmNshadowThickness, 0); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
139 | XtSetArg(args[1], XmNleftAttachment, XmATTACH_FORM); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
140 | XtSetArg(args[2], XmNrightAttachment, XmATTACH_FORM); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
141 | XtSetArg(args[3], XmNtopAttachment, XmATTACH_FORM); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
142 | XtSetArg(args[4], XmNbottomAttachment, XmATTACH_FORM); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
143 | XtSetArg(args[5], XmNuserData, tab); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
144 | Widget frame = XmCreateFrame(view->widget, "tab", args, 6); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
145 | XtManageChild(frame); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
146 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
147 | UiObject *content = ui_malloc(view->ctx, sizeof(UiObject)); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
148 | content->widget = NULL; // initialization for uic_context() |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
149 | content->ctx = uic_context(content, view->ctx->mempool); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
150 | content->ctx->parent = view->ctx; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
151 | content->ctx->set_document = ui_tab_set_document; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
152 | content->ctx->detach_document = ui_tab_detach_document; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
153 | content->widget = frame; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
154 | content->window = view->ctx->obj->window; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
155 | content->container = ui_frame_container(content, frame); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
156 | content->next = NULL; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
157 | |
53
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
158 | // add tab button |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
159 | v->tabs = ucx_list_append_a(view->ctx->mempool->allocator, v->tabs, tab); |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
160 | |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
161 | XmString label = XmStringCreateLocalized("tab"); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
162 | XtSetArg(args[0], XmNlabelString, label); |
54
97bafeca1c7c
added Qt window and menu implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
163 | XtSetArg(args[1], XmNshadowThickness, 0); |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
164 | XtSetArg(args[2], XmNtraversalOn, FALSE); |
53
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
165 | XtSetArg(args[3], XmNtopAttachment, XmATTACH_FORM); |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
166 | XtSetArg(args[4], XmNbottomAttachment, XmATTACH_FORM); |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
167 | XtSetArg(args[5], XmNhighlightThickness, 0); |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
168 | XtSetArg(args[6], XmNindicatorOn, XmINDICATOR_NONE); |
54
97bafeca1c7c
added Qt window and menu implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
169 | XtSetArg(args[7], XmNfillOnSelect, TRUE); |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
170 | |
54
97bafeca1c7c
added Qt window and menu implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
171 | Widget button = XmCreateToggleButton(v->tabbar, "tab_button", args, 8); |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
172 | tab->tabbedpane = v; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
173 | tab->content = content; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
174 | tab->tab_button = button; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
175 | |
53
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
176 | // layout |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
177 | int is_first = 1; |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
178 | size_t count = ucx_list_size(v->tabs); |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
179 | int part = 100 / count; |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
180 | int pos = 0; |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
181 | int i = 0; |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
182 | UCX_FOREACH(elm, v->tabs) { |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
183 | UiTab *tt = elm->data; |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
184 | if(is_first) { |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
185 | XtVaSetValues( |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
186 | tt->tab_button, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
187 | XmNleftAttachment, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
188 | XmATTACH_FORM, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
189 | XmNrightAttachment, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
190 | XmATTACH_POSITION, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
191 | XmNrightPosition, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
192 | pos + part, |
54
97bafeca1c7c
added Qt window and menu implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
193 | XmNset, |
97bafeca1c7c
added Qt window and menu implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
194 | FALSE, |
53
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
195 | NULL); |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
196 | is_first = FALSE; |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
197 | } else if(i < count - 1) { |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
198 | XtVaSetValues( |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
199 | tt->tab_button, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
200 | XmNleftAttachment, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
201 | XmATTACH_POSITION, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
202 | XmNleftPosition, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
203 | pos, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
204 | XmNrightAttachment, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
205 | XmATTACH_POSITION, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
206 | XmNrightPosition, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
207 | pos + part, |
54
97bafeca1c7c
added Qt window and menu implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
208 | XmNset, |
97bafeca1c7c
added Qt window and menu implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
209 | FALSE, |
53
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
210 | NULL); |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
211 | } else { |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
212 | XtVaSetValues( |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
213 | tt->tab_button, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
214 | XmNleftAttachment, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
215 | XmATTACH_POSITION, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
216 | XmNleftPosition, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
217 | pos, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
218 | XmNrightAttachment, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
219 | XmATTACH_FORM, |
54
97bafeca1c7c
added Qt window and menu implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
220 | XmNset, |
97bafeca1c7c
added Qt window and menu implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
221 | FALSE, |
53
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
222 | NULL); |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
223 | } |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
224 | pos += part; |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
225 | i++; |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
226 | } |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
227 | |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
228 | XtManageChild(button); |
54
97bafeca1c7c
added Qt window and menu implementation
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
53
diff
changeset
|
229 | XtVaSetValues(button, XmNset, TRUE, NULL); |
53
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
230 | XtAddCallback( |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
231 | button, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
232 | XmNvalueChangedCallback, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
233 | (XtCallbackProc)ui_tab_button_callback, |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
234 | tab); |
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
235 | |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
236 | v->current = tab; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
237 | ui_change_tab(v, tab); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
238 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
239 | return content; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
240 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
241 | |
53
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
242 | void ui_tab_button_callback(Widget widget, UiTab *tab, XtPointer d) { |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
243 | MotifTabbedPane *t = tab->tabbedpane; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
244 | if(t->current) { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
245 | XtUnmanageChild(t->current->content->widget); |
53
62205699cd0e
improved motif tabs
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
52
diff
changeset
|
246 | XtVaSetValues(t->current->tab_button, XmNset, 0, NULL); |
52
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
247 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
248 | XtManageChild(tab->content->widget); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
249 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
250 | t->current = tab; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
251 | ui_change_tab(t, tab); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
252 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
253 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
254 | void ui_change_tab(MotifTabbedPane *pane, UiTab *tab) { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
255 | UiContext *ctx = tab->content->ctx; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
256 | ctx->parent->set_document(ctx->parent, ctx->document); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
257 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
258 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
259 | void ui_tab_set_document(UiContext *ctx, void *document) { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
260 | if(ctx->parent->document) { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
261 | //ctx->parent->detach_document(ctx->parent, ctx->parent->document); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
262 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
263 | uic_context_set_document(ctx, document); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
264 | //uic_context_set_document(ctx->parent, document); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
265 | //ctx->parent->document = document; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
266 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
267 | UiTab *tab = NULL; |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
268 | XtVaGetValues( |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
269 | ctx->obj->widget, |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
270 | XmNuserData, |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
271 | &tab, |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
272 | NULL); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
273 | if(tab) { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
274 | if(tab->tabbedpane->current == tab) { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
275 | ctx->parent->set_document(ctx->parent, ctx->document); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
276 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
277 | } else { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
278 | fprintf(stderr, "UiError: ui_bar_set_document: Cannot set document"); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
279 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
280 | } |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
281 | |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
282 | void ui_tab_detach_document(UiContext *ctx, void *document) { |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
283 | uic_context_detach_document(ctx->parent, document); |
25e5390cce41
added document tabview (GTK, Motif)
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
36
diff
changeset
|
284 | } |