1 /*
2  * Motif
3  *
4  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 #ifndef _XmTabStackP_h_
25 #define _XmTabStackP_h_
26 
27 #include <Xm/XmP.h>
28 #include <Xm/ManagerP.h>
29 #include <Xm/BulletinBP.h>
30 #include <Xm/ExtP.h>
31 #include <Xm/TabBox.h>
32 #include <Xm/TabList.h>
33 #include <Xm/TabStack.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 typedef struct _XmTabStackClassPart {
40     String    drag_translations;
41     XtPointer extension;
42 } XmTabStackClassPart;
43 
44 
45 typedef struct _XmTabStackClassRec {
46     CoreClassPart            core_class;
47     CompositeClassPart	     composite_class;
48     ConstraintClassPart      constraint_class;
49     XmManagerClassPart       manager_class;
50     XmBulletinBoardClassPart bulletin_board_class;
51     XmTabStackClassPart      tab_stack_class;
52 } XmTabStackClassRec;
53 externalref XmTabStackClassRec xmTabStackClassRec;
54 
55 typedef struct _XmTabStackPart {
56     /* Resources for the Tab Stack */
57 
58     XtCallbackList       tab_select_callback;
59 
60     /* Resource to pass down to Tab Box */
61     XmFontList		 font_list;
62     XmTabStyle		 tab_style;
63     XmTabMode		 tab_mode;
64     XmTabSide            tab_side;
65     XmTabOrientation	 tab_orientation;
66 
67     XmString		 tear_off_label;
68 
69     Boolean		 allow_tear_offs;
70     Boolean		 uniform_tab_size;
71     Boolean		 use_image_cache;
72     Boolean		 stacked_effect;
73     Boolean		 tab_auto_select;
74 
75     Dimension            tab_margin_width;
76     Dimension            tab_margin_height;
77     Dimension		 tab_label_spacing;
78     Dimension            tab_offset;
79     Dimension            highlight_thickness;
80 
81     Pixel		 select_color;
82     Pixel		 select_pixmap;
83 
84     int			 tab_corner_percent;
85 
86     Widget               tab_box;
87 
88     /* Private Values */
89 
90     XmTabbedStackList		 _tab_list;
91 
92     XRectangle           _size;
93 
94     Widget               _active_child;
95     GC			 _gc;
96 
97     Boolean		 _inited;
98     Boolean		 _set_tab_list;
99 
100     Widget               _menu;
101     Widget		 _tear_off_button;
102 
103     /* Drag And Drop Stuff */
104     Pixmap               _source_pixmap;
105     Pixmap               _source_mask;
106     Pixmap               _invalid_pixmap;
107     Pixmap               _invalid_mask;
108     Widget               _source_icon;
109     Widget               _invalid_icon;
110 
111     Widget		_selected_tab;	    /* used within realize method */
112     Boolean		_selected_notify;   /* used within realize method */
113 
114     Boolean		do_notify;	/* for notify XmNtabSelectedCallback */
115 
116     Boolean		check_set_render_table;
117 
118 } XmTabStackPart;
119 
120 #define XmTabStack_tab_select_callback(w) (((XmTabStackWidget)(w))->tab_stack.tab_select_callback)
121 #define XmTabStack_font_list(w) (((XmTabStackWidget)(w))->tab_stack.font_list)
122 #define XmTabStack_tab_style(w) (((XmTabStackWidget)(w))->tab_stack.tab_style)
123 #define XmTabStack_tab_mode(w) (((XmTabStackWidget)(w))->tab_stack.tab_mode)
124 #define XmTabStack_tab_side(w) (((XmTabStackWidget)(w))->tab_stack.tab_side)
125 #define XmTabStack_tab_orientation(w) (((XmTabStackWidget)(w))->tab_stack.tab_orientation)
126 #define XmTabStack_tear_off_label(w) (((XmTabStackWidget)(w))->tab_stack.tear_off_label)
127 #define XmTabStack_allow_tear_offs(w) (((XmTabStackWidget)(w))->tab_stack.allow_tear_offs)
128 #define XmTabStack_uniform_tab_size(w) (((XmTabStackWidget)(w))->tab_stack.uniform_tab_size)
129 #define XmTabStack_use_image_cache(w) (((XmTabStackWidget)(w))->tab_stack.use_image_cache)
130 #define XmTabStack_stacked_effect(w) (((XmTabStackWidget)(w))->tab_stack.stacked_effect)
131 #define XmTabStack_tab_auto_select(w) (((XmTabStackWidget)(w))->tab_stack.tab_auto_select)
132 #define XmTabStack_tab_margin_width(w) (((XmTabStackWidget)(w))->tab_stack.tab_margin_width)
133 #define XmTabStack_tab_margin_height(w) (((XmTabStackWidget)(w))->tab_stack.tab_margin_height)
134 #define XmTabStack_tab_label_spacing(w) (((XmTabStackWidget)(w))->tab_stack.tab_label_spacing)
135 #define XmTabStack_tab_offset(w) (((XmTabStackWidget)(w))->tab_stack.tab_offset)
136 #define XmTabStack_highlight_thickness(w) (((XmTabStackWidget)(w))->tab_stack.highlight_thickness)
137 #define XmTabStack_select_color(w) (((XmTabStackWidget)(w))->tab_stack.select_color)
138 #define XmTabStack_select_pixmap(w) (((XmTabStackWidget)(w))->tab_stack.select_pixmap)
139 #define XmTabStack_tab_corner_percent(w) (((XmTabStackWidget)(w))->tab_stack.tab_corner_percent)
140 #define XmTabStack_tab_box(w) (((XmTabStackWidget)(w))->tab_stack.tab_box)
141 #define XmTabStack__tab_list(w) (((XmTabStackWidget)(w))->tab_stack._tab_list)
142 #define XmTabStack__size(w) (((XmTabStackWidget)(w))->tab_stack._size)
143 #define XmTabStack__active_child(w) (((XmTabStackWidget)(w))->tab_stack._active_child)
144 #define XmTabStack__gc(w) (((XmTabStackWidget)(w))->tab_stack._gc)
145 #define XmTabStack__inited(w) (((XmTabStackWidget)(w))->tab_stack._inited)
146 #define XmTabStack__set_tab_list(w) (((XmTabStackWidget)(w))->tab_stack._set_tab_list)
147 #define XmTabStack__menu(w) (((XmTabStackWidget)(w))->tab_stack._menu)
148 #define XmTabStack__tear_off_button(w) (((XmTabStackWidget)(w))->tab_stack._tear_off_button)
149 #define XmTabStack__source_pixmap(w) (((XmTabStackWidget)(w))->tab_stack._source_pixmap)
150 #define XmTabStack__source_mask(w) (((XmTabStackWidget)(w))->tab_stack._source_mask)
151 #define XmTabStack__invalid_pixmap(w) (((XmTabStackWidget)(w))->tab_stack._invalid_pixmap)
152 #define XmTabStack__invalid_mask(w) (((XmTabStackWidget)(w))->tab_stack._invalid_mask)
153 #define XmTabStack__source_icon(w) (((XmTabStackWidget)(w))->tab_stack._source_icon)
154 #define XmTabStack__invalid_icon(w) (((XmTabStackWidget)(w))->tab_stack._invalid_icon)
155 #define XmTabStack__selected_tab(w) (((XmTabStackWidget)(w))->tab_stack._selected_tab)
156 #define XmTabStack__selected_notify(w) (((XmTabStackWidget)(w))->tab_stack._selected_notify)
157 #define XmTabStack_do_notify(w) (((XmTabStackWidget)(w))->tab_stack.do_notify)
158 
159 typedef struct _XmTabStackRec {
160     CorePart             core;
161     CompositePart        composite;
162     ConstraintPart       constraint;
163     XmManagerPart        manager;
164     XmBulletinBoardPart  bulletin_board;
165     XmTabStackPart       tab_stack;
166 } XmTabStackRec;
167 
168 typedef struct _XmTabStackConstraintPart {
169     XmString    	 tab_label_string;
170     XmStringDirection    tab_string_direction;
171     unsigned char        tab_alignment;
172     Pixmap		 tab_label_pixmap;
173     XmPixmapPlacement    tab_pixmap_placement;
174     Pixel		 tab_foreground;
175     Pixel		 tab_background;
176     Pixmap		 tab_background_pixmap;
177     Boolean		 free_tab_pixmap;
178 
179     Boolean		 tear_off_enabled;
180 
181     /* Private Memebers */
182     int			index;
183     Dimension		width;
184     Dimension		height;
185 } XmTabStackConstraintPart;
186 
187 #define XmTabStackC_tab_label_string(w) \
188     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.tab_label_string)
189 #define XmTabStackC_tab_string_direction(w) \
190     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.tab_string_direction)
191 #define XmTabStackC_tab_alignment(w) \
192     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.tab_alignment)
193 #define XmTabStackC_tab_label_pixmap(w) \
194     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.tab_label_pixmap)
195 #define XmTabStackC_tab_pixmap_placement(w) \
196     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.tab_pixmap_placement)
197 #define XmTabStackC_tab_foreground(w) \
198     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.tab_foreground)
199 #define XmTabStackC_tab_background(w) \
200     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.tab_background)
201 #define XmTabStackC_tab_background_pixmap(w) \
202     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.tab_background_pixmap)
203 #define XmTabStackC_free_tab_pixmap(w) \
204     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.free_tab_pixmap)
205 #define XmTabStackC_tear_off_enabled(w) \
206     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.tear_off_enabled)
207 #define XmTabStackC_index(w) \
208     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.index)
209 #define XmTabStackC_width(w) \
210     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.width)
211 #define XmTabStackC_height(w) \
212     (((XmTabStackConstraintPtr)((w)->core.constraints))->tab_stack.height)
213 
214 typedef struct _XmTabStackConstraintRec {
215     XmManagerConstraintPart  manager;
216     XmTabStackConstraintPart tab_stack;
217 } XmTabStackConstraintRec, * XmTabStackConstraintPtr;
218 
219 #define XmNillegalUniformTabSizeMsg \
220 "XmNuniformTabSize must be true if XmNtabMode is XmTABS_STACKED or\n\
221 XmTABS_STACKED_STATIC."
222 
223 #define XmTabStackIndex (XmBulletinBoardIndex + 1)
224 
225 #ifdef __cplusplus
226 } /* Close scope of 'extern "C"' declaration */
227 #endif
228 
229 
230 #endif /* _TabStackP_h_ */
231