added color editing and title justification to appearance section
[wmaker-crm.git] / WINGs / WINGsP.h
blob9e677afcb86ffe11b02a563f67a57460a2218bba
1 #ifndef _WINGSP_H_
2 #define _WINGSP_H_
5 #include <X11/Xlib.h>
6 #include <X11/Xutil.h>
9 #include "WINGs.h"
11 #if WINGS_H_VERSION < 990222
12 #error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
13 #endif
15 #include <assert.h>
17 #include <stdlib.h>
18 #include <string.h>
19 #include <stdio.h>
21 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
25 #define DOUBLE_BUFFER
29 #define WC_UserWidget 128
33 #define SCROLLER_WIDTH 20
35 /* internal messages */
36 #define WM_UPDATE_COLORWELL 130
39 #define WM_USER_MESSAGE 1024
42 #define SETUP_INTERNAL_MESSAGE(event, scrPtr) \
43 event.xclient.type=ClientMessage;\
44 event.xclient.display=scrPtr->display;\
45 event.xclient.send_event=False;\
46 event.xclient.serial=0;\
47 event.xclient.format=32;\
48 event.xclient.message_type=scrPtr->internalMessage;
51 typedef struct W_Font {
52 struct W_Screen *screen;
54 union {
55 XFontSet set;
56 XFontStruct *normal;
57 } font;
58 short height;
59 short y;
60 short refCount;
61 char *name;
62 unsigned int notFontSet:1;
63 } W_Font;
66 typedef struct W_Pixmap {
67 struct W_Screen *screen;
68 Pixmap pixmap;
69 Pixmap mask;
70 unsigned short width;
71 unsigned short height;
72 short depth;
73 short refCount;
74 } W_Pixmap;
77 typedef struct W_Color {
78 struct W_Screen *screen;
80 XColor color;
81 short refCount;
82 GC gc;
83 struct {
84 unsigned int exact:1;
85 } flags;
86 } W_Color;
89 typedef struct W_FocusInfo {
90 struct W_View *toplevel;
91 struct W_View *focused; /* view that has the focus in this toplevel */
92 struct W_FocusInfo *next;
93 } W_FocusInfo;
95 typedef struct W_Screen {
96 Display *display;
97 int screen;
98 int depth;
100 Colormap colormap;
102 Visual *visual;
104 Time lastEventTime;
106 Window rootWin;
108 struct W_View *rootView;
110 RContext *rcontext;
112 /* application related */
114 W_FocusInfo *focusInfo;
116 struct W_Pixmap *applicationIcon;
118 struct W_Window *windowList; /* list of windows in the app */
120 Window groupLeader; /* the leader of the application */
121 /* also used for other things */
123 struct W_SelectionHandlers *selectionHandlerList;
125 struct {
126 unsigned int hasAppIcon:1;
127 unsigned int simpleApplication:1;
128 } aflags;
130 WMOpenPanel *sharedOpenPanel;
131 WMSavePanel *sharedSavePanel;
133 struct W_FontPanel *sharedFontPanel;
135 struct W_ColorPanel *sharedColorPanel;
137 Pixmap stipple;
139 /* colors */
140 W_Color *white;
141 W_Color *black;
142 W_Color *gray;
143 W_Color *darkGray;
145 GC stippleGC;
147 GC copyGC;
148 GC clipGC;
150 GC monoGC; /* GC for 1bpp visuals */
152 GC xorGC;
154 GC ixorGC; /* IncludeInferiors XOR */
156 GC textFieldGC;
158 W_Font *normalFont;
160 W_Font *boldFont;
162 WMHashTable *fontCache;
165 struct W_Balloon *balloon;
168 struct W_Pixmap *checkButtonImageOn;
169 struct W_Pixmap *checkButtonImageOff;
171 struct W_Pixmap *radioButtonImageOn;
172 struct W_Pixmap *radioButtonImageOff;
174 struct W_Pixmap *buttonArrow;
175 struct W_Pixmap *pushedButtonArrow;
177 struct W_Pixmap *scrollerDimple;
179 struct W_Pixmap *upArrow;
180 struct W_Pixmap *downArrow;
181 struct W_Pixmap *leftArrow;
182 struct W_Pixmap *rightArrow;
184 struct W_Pixmap *hiUpArrow;
185 struct W_Pixmap *hiDownArrow;
186 struct W_Pixmap *hiLeftArrow;
187 struct W_Pixmap *hiRightArrow;
189 struct W_Pixmap *pullDownIndicator;
190 struct W_Pixmap *popUpIndicator;
192 struct W_Pixmap *checkMark;
194 struct W_Pixmap *homeIcon;
195 struct W_Pixmap *altHomeIcon;
197 struct W_Pixmap *magnifyIcon;
198 /* struct W_Pixmap *altMagnifyIcon;*/
199 struct W_Pixmap *wheelIcon;
200 struct W_Pixmap *grayIcon;
201 struct W_Pixmap *rgbIcon;
202 struct W_Pixmap *cmykIcon;
203 struct W_Pixmap *hsbIcon;
204 struct W_Pixmap *customPaletteIcon;
205 struct W_Pixmap *colorListIcon;
207 struct W_Pixmap *defaultObjectIcon;
209 Cursor defaultCursor;
211 Cursor textCursor;
213 Cursor invisibleCursor;
215 Atom internalMessage; /* for ClientMessage */
217 Atom attribsAtom; /* GNUstepWindowAttributes */
219 Atom deleteWindowAtom; /* WM_DELETE_WINDOW */
221 Atom protocolsAtom; /* _XA_WM_PROTOCOLS */
223 Atom clipboardAtom; /* CLIPBOARD */
226 /* stuff for detecting double-clicks */
227 Time lastClickTime; /* time of last mousedown event */
228 Window lastClickWindow; /* window of the last mousedown */
230 struct W_View *modalView;
231 unsigned modal:1;
232 unsigned ignoreNextDoubleClick:1;
233 } W_Screen;
237 typedef struct W_View {
238 struct W_Screen *screen;
240 WMWidget *self; /* must point to the widget the
241 * view belongs to */
243 Window window;
245 WMSize size;
247 WMPoint pos;
249 struct W_View *nextFocusChain; /* next/prev in focus chain */
250 struct W_View *prevFocusChain;
252 struct W_View *parent; /* parent WMView */
254 struct W_View *childrenList; /* first in list of child windows */
256 struct W_View *nextSister; /* next on parent's children list */
258 struct W_EventHandler *handlerList;/* list of event handlers for this window */
260 unsigned long attribFlags;
261 XSetWindowAttributes attribs;
263 void *hangedData; /* data holder for user program */
265 WMColor *backColor;
267 #if 0
268 struct W_DragSourceProcs *dragSourceProcs;
269 struct W_DragDestinationProcs *dragDestinationProcs;
270 int helpContext;
271 #endif
273 struct {
274 unsigned int realized:1;
275 unsigned int mapped:1;
276 unsigned int parentDying:1;
277 unsigned int dying:1; /* the view is being destroyed */
278 unsigned int topLevel:1; /* is a top level window */
279 unsigned int root:1; /* is the root window */
280 unsigned int mapWhenRealized:1;/* map the view when it's realized */
281 unsigned int alreadyDead:1; /* view was freed */
283 unsigned int dontCompressMotion:1; /* motion notify event compress */
284 unsigned int notifySizeChanged:1;
285 unsigned int dontCompressExpose:1; /* will compress all expose
286 events into one */
287 /* toplevel only */
288 unsigned int worksWhenModal:1;
289 unsigned int pendingRelease1:1;
290 unsigned int pendingRelease2:1;
291 unsigned int pendingRelease3:1;
292 unsigned int pendingRelease4:1;
293 unsigned int pendingRelease5:1;
294 } flags;
296 int refCount;
297 } W_View;
300 typedef struct W_EventHandler {
301 unsigned long eventMask;
303 WMEventProc *proc;
305 void *clientData;
307 struct W_EventHandler *nextHandler;
308 } W_EventHandler;
312 typedef struct W_ViewProcedureTable {
313 void (*setBackgroundColor)(WMWidget*, WMColor *color);
314 void (*resize)(WMWidget*, unsigned int, unsigned int);
315 void (*move)(WMWidget*, int, int);
316 } W_ViewProcedureTable;
320 typedef struct _WINGsConfiguration {
321 char *systemFont;
322 char *boldSystemFont;
323 unsigned doubleClickDelay;
324 } _WINGsConfiguration;
326 _WINGsConfiguration WINGsConfiguration;
330 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
333 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
334 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
336 #define W_VIEW_REALIZED(view) (view)->flags.realized
337 #define W_VIEW_MAPPED(view) (view)->flags.mapped
339 #define W_PIXEL(c) (c)->color.pixel
341 #define W_FONTID(f) (f)->font->fid
343 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
347 W_View *W_GetViewForXWindow(Display *display, Window window);
349 W_View *W_CreateView(W_View *parent);
351 W_View *W_CreateTopView(W_Screen *screen);
354 W_View *W_CreateRootView(W_Screen *screen);
356 void W_DestroyView(W_View *view);
358 void W_RealizeView(W_View *view);
360 void W_ReparentView(W_View *view, W_View *newParent, int x, int y);
362 void W_MapView(W_View *view);
364 void W_MapSubviews(W_View *view);
366 void W_UnmapSubviews(W_View *view);
368 W_View *W_TopLevelOfView(W_View *view);
370 void W_UnmapView(W_View *view);
372 void W_MoveView(W_View *view, int x, int y);
374 void W_ResizeView(W_View *view, unsigned int width, unsigned int height);
376 void W_SetViewBackgroundColor(W_View *view, WMColor *color);
378 void W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
379 unsigned int height, WMReliefType relief);
382 void W_CleanUpEvents(W_View *view);
384 void W_CallDestroyHandlers(W_View *view);
386 void W_PaintTextAndImage(W_View *view, int wrap, GC textGC, W_Font *font,
387 WMReliefType relief, char *text,
388 WMAlignment alignment, W_Pixmap *image,
389 WMImagePosition position, GC backGC, int ofs);
391 void W_PaintText(W_View *view, Drawable d, WMFont *font, int x, int y,
392 int width, WMAlignment alignment, GC gc,
393 int wrap, char *text, int length);
395 int W_GetTextHeight(WMFont *font, char *text, int width, int wrap);
398 int W_TextWidth(WMFont *font, char *text, int length);
401 void W_BroadcastMessage(W_View *targetParent, XEvent *event);
403 void W_DispatchMessage(W_View *target, XEvent *event);
405 Bool W_CheckInternalMessage(W_Screen *scr, XClientMessageEvent *cev, int event);
407 void W_SetFocusOfToplevel(W_View *toplevel, W_View *view);
409 W_View *W_FocusedViewOfToplevel(W_View *view);
411 void W_SetFocusOfTopLevel(W_View *toplevel, W_View *view);
413 void W_ReleaseView(WMView *view);
415 WMView *W_RetainView(WMView *view);
417 void W_InitApplication(WMScreen *scr);
419 void W_InitNotificationCenter(void);
421 W_Class W_RegisterUserWidget(W_ViewProcedureTable *procTable);
423 void W_RedisplayView(WMView *view);
425 Bool W_ApplicationInitialized(void);
427 char *W_GetTextSelection(WMScreen *scr, Atom selection);
429 void W_HandleSelectionEvent(XEvent *event);
431 #ifdef __cplusplus
433 #endif /* __cplusplus */
435 #endif /* _WINGSP_H_ */
437 void W_FlushASAPNotificationQueue();
439 void W_FlushIdleNotificationQueue();
441 struct W_Balloon *W_CreateBalloon(WMScreen *scr);
443 void W_BalloonHandleEnterView(WMView *view);
445 void W_BalloonHandleLeaveView(WMView *view);