Buttons in filepanel.
[wmaker-crm.git] / WINGs / WINGsP.h
blobc03cbb456a4b639743628dedc2827cfeb14f5cca
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 < 990516
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;
96 typedef struct W_Screen {
97 Display *display;
98 int screen;
99 int depth;
101 Colormap colormap;
103 Visual *visual;
105 Time lastEventTime;
107 Window rootWin;
109 struct W_View *rootView;
111 RContext *rcontext;
113 /* application related */
115 W_FocusInfo *focusInfo;
117 struct W_Pixmap *applicationIcon;
119 struct W_Window *windowList; /* list of windows in the app */
121 Window groupLeader; /* the leader of the application */
122 /* also used for other things */
124 struct W_SelectionHandlers *selectionHandlerList;
126 struct {
127 unsigned int hasAppIcon:1;
128 unsigned int simpleApplication:1;
129 } aflags;
131 WMOpenPanel *sharedOpenPanel;
132 WMSavePanel *sharedSavePanel;
134 struct W_FontPanel *sharedFontPanel;
136 struct W_ColorPanel *sharedColorPanel;
138 Pixmap stipple;
140 /* colors */
141 W_Color *white;
142 W_Color *black;
143 W_Color *gray;
144 W_Color *darkGray;
146 GC stippleGC;
148 GC copyGC;
149 GC clipGC;
151 GC monoGC; /* GC for 1bpp visuals */
153 GC xorGC;
155 GC ixorGC; /* IncludeInferiors XOR */
157 GC textFieldGC;
159 W_Font *normalFont;
161 W_Font *boldFont;
163 WMHashTable *fontCache;
165 Bool useMultiByte;
167 struct W_Balloon *balloon;
170 struct W_Pixmap *checkButtonImageOn;
171 struct W_Pixmap *checkButtonImageOff;
173 struct W_Pixmap *radioButtonImageOn;
174 struct W_Pixmap *radioButtonImageOff;
176 struct W_Pixmap *buttonArrow;
177 struct W_Pixmap *pushedButtonArrow;
179 struct W_Pixmap *scrollerDimple;
181 struct W_Pixmap *upArrow;
182 struct W_Pixmap *downArrow;
183 struct W_Pixmap *leftArrow;
184 struct W_Pixmap *rightArrow;
186 struct W_Pixmap *hiUpArrow;
187 struct W_Pixmap *hiDownArrow;
188 struct W_Pixmap *hiLeftArrow;
189 struct W_Pixmap *hiRightArrow;
191 struct W_Pixmap *pullDownIndicator;
192 struct W_Pixmap *popUpIndicator;
194 struct W_Pixmap *checkMark;
196 struct W_Pixmap *homeIcon;
197 struct W_Pixmap *altHomeIcon;
199 struct W_Pixmap *trashcanIcon;
200 struct W_Pixmap *altTrashcanIcon;
202 struct W_Pixmap *createDirIcon;
203 struct W_Pixmap *altCreateDirIcon;
205 struct W_Pixmap *disketteIcon;
206 struct W_Pixmap *altDisketteIcon;
207 struct W_Pixmap *unmountIcon;
208 struct W_Pixmap *altUnmountIcon;
210 struct W_Pixmap *magnifyIcon;
211 /* struct W_Pixmap *altMagnifyIcon;*/
212 struct W_Pixmap *wheelIcon;
213 struct W_Pixmap *grayIcon;
214 struct W_Pixmap *rgbIcon;
215 struct W_Pixmap *cmykIcon;
216 struct W_Pixmap *hsbIcon;
217 struct W_Pixmap *customPaletteIcon;
218 struct W_Pixmap *colorListIcon;
220 struct W_Pixmap *defaultObjectIcon;
222 Cursor defaultCursor;
224 Cursor textCursor;
226 Cursor invisibleCursor;
228 Atom internalMessage; /* for ClientMessage */
230 Atom attribsAtom; /* GNUstepWindowAttributes */
232 Atom deleteWindowAtom; /* WM_DELETE_WINDOW */
234 Atom protocolsAtom; /* _XA_WM_PROTOCOLS */
236 Atom clipboardAtom; /* CLIPBOARD */
239 /* stuff for detecting double-clicks */
240 Time lastClickTime; /* time of last mousedown event */
241 Window lastClickWindow; /* window of the last mousedown */
243 struct W_View *modalView;
244 unsigned modal:1;
245 unsigned ignoreNextDoubleClick:1;
246 } W_Screen;
250 typedef struct W_ViewDelegate {
251 void *data;
253 void (*didMove)(struct W_ViewDelegate*, WMView*);
255 void (*didResize)(struct W_ViewDelegate*, WMView*);
257 void (*willMove)(struct W_ViewDelegate*, WMView*, int*, int*);
259 void (*willResize)(struct W_ViewDelegate*, WMView*,
260 unsigned int*, unsigned int*);
261 } W_ViewDelegate;
265 typedef struct W_View {
266 struct W_Screen *screen;
268 WMWidget *self; /* must point to the widget the
269 * view belongs to */
271 W_ViewDelegate *delegate;
273 Window window;
275 WMSize size;
277 WMPoint pos;
279 struct W_View *nextFocusChain; /* next/prev in focus chain */
280 struct W_View *prevFocusChain;
282 struct W_View *parent; /* parent WMView */
284 struct W_View *childrenList; /* first in list of child windows */
286 struct W_View *nextSister; /* next on parent's children list */
288 struct W_EventHandler *handlerList;/* list of event handlers for this window */
290 unsigned long attribFlags;
291 XSetWindowAttributes attribs;
293 void *hangedData; /* data holder for user program */
295 WMColor *backColor;
297 #if 0
298 struct W_DragSourceProcs *dragSourceProcs;
299 struct W_DragDestinationProcs *dragDestinationProcs;
300 int helpContext;
301 #endif
303 struct {
304 unsigned int realized:1;
305 unsigned int mapped:1;
306 unsigned int parentDying:1;
307 unsigned int dying:1; /* the view is being destroyed */
308 unsigned int topLevel:1; /* is a top level window */
309 unsigned int root:1; /* is the root window */
310 unsigned int mapWhenRealized:1;/* map the view when it's realized */
311 unsigned int alreadyDead:1; /* view was freed */
313 unsigned int dontCompressMotion:1; /* motion notify event compress */
314 unsigned int notifySizeChanged:1;
315 unsigned int dontCompressExpose:1; /* will compress all expose
316 events into one */
317 /* toplevel only */
318 unsigned int worksWhenModal:1;
319 unsigned int pendingRelease1:1;
320 unsigned int pendingRelease2:1;
321 unsigned int pendingRelease3:1;
322 unsigned int pendingRelease4:1;
323 unsigned int pendingRelease5:1;
324 } flags;
326 int refCount;
327 } W_View;
330 typedef struct W_EventHandler {
331 unsigned long eventMask;
333 WMEventProc *proc;
335 void *clientData;
337 struct W_EventHandler *nextHandler;
338 } W_EventHandler;
343 typedef struct _WINGsConfiguration {
344 char *systemFont;
345 char *boldSystemFont;
346 Bool useMultiByte;
347 unsigned doubleClickDelay;
348 } _WINGsConfiguration;
350 _WINGsConfiguration WINGsConfiguration;
354 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
357 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
358 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
360 #define W_VIEW_REALIZED(view) (view)->flags.realized
361 #define W_VIEW_MAPPED(view) (view)->flags.mapped
363 #define W_PIXEL(c) (c)->color.pixel
365 #define W_FONTID(f) (f)->font->fid
367 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
371 W_View *W_GetViewForXWindow(Display *display, Window window);
373 W_View *W_CreateView(W_View *parent);
375 W_View *W_CreateTopView(W_Screen *screen);
378 W_View *W_CreateRootView(W_Screen *screen);
380 void W_DestroyView(W_View *view);
382 void W_RealizeView(W_View *view);
384 void W_ReparentView(W_View *view, W_View *newParent, int x, int y);
386 void W_MapView(W_View *view);
388 void W_MapSubviews(W_View *view);
390 void W_UnmapSubviews(W_View *view);
392 W_View *W_TopLevelOfView(W_View *view);
394 void W_UnmapView(W_View *view);
396 void W_MoveView(W_View *view, int x, int y);
398 void W_ResizeView(W_View *view, unsigned int width, unsigned int height);
400 void W_SetViewBackgroundColor(W_View *view, WMColor *color);
402 void W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
403 unsigned int height, WMReliefType relief);
406 void W_CleanUpEvents(W_View *view);
408 void W_CallDestroyHandlers(W_View *view);
410 void W_PaintTextAndImage(W_View *view, int wrap, GC textGC, W_Font *font,
411 WMReliefType relief, char *text,
412 WMAlignment alignment, W_Pixmap *image,
413 WMImagePosition position, GC backGC, int ofs);
415 void W_PaintText(W_View *view, Drawable d, WMFont *font, int x, int y,
416 int width, WMAlignment alignment, GC gc,
417 int wrap, char *text, int length);
419 int W_GetTextHeight(WMFont *font, char *text, int width, int wrap);
422 int W_TextWidth(WMFont *font, char *text, int length);
425 void W_BroadcastMessage(W_View *targetParent, XEvent *event);
427 void W_DispatchMessage(W_View *target, XEvent *event);
429 Bool W_CheckInternalMessage(W_Screen *scr, XClientMessageEvent *cev, int event);
431 void W_SetFocusOfToplevel(W_View *toplevel, W_View *view);
433 W_View *W_FocusedViewOfToplevel(W_View *view);
435 void W_SetFocusOfTopLevel(W_View *toplevel, W_View *view);
437 void W_ReleaseView(WMView *view);
439 WMView *W_RetainView(WMView *view);
441 void W_InitApplication(WMScreen *scr);
443 void W_InitNotificationCenter(void);
445 W_Class W_RegisterUserWidget(void);
447 void W_RedisplayView(WMView *view);
449 Bool W_ApplicationInitialized(void);
451 char *W_GetTextSelection(WMScreen *scr, Atom selection);
453 void W_HandleSelectionEvent(XEvent *event);
455 #ifdef __cplusplus
457 #endif /* __cplusplus */
459 #endif /* _WINGSP_H_ */
461 void W_FlushASAPNotificationQueue();
463 void W_FlushIdleNotificationQueue();
465 struct W_Balloon *W_CreateBalloon(WMScreen *scr);
467 void W_BalloonHandleEnterView(WMView *view);
469 void W_BalloonHandleLeaveView(WMView *view);