Remove warnings
[wmaker-crm.git] / WINGs / WINGs / WINGsP.h
bloba619a702b0b08adc39b13ebc13e6f9c108bea752
1 #ifndef _WINGSP_H_
2 #define _WINGSP_H_
5 #include <X11/Xlib.h>
6 #include <X11/Xutil.h>
9 #include <WINGs/WINGs.h>
11 #if WINGS_H_VERSION < 20041030
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 <strings.h>
20 #include <stdio.h>
22 #ifdef __cplusplus
23 extern "C" {
24 #endif /* __cplusplus */
27 #define DOUBLE_BUFFER 1
29 #define WC_UserWidget 128
31 #define SCROLLER_WIDTH 20
33 #define XDND_VERSION 3
36 typedef struct W_Application {
37 char *applicationName;
38 int argc;
39 char **argv;
40 char *resourcePath;
41 } W_Application;
44 typedef struct W_Font {
45 struct W_Screen *screen;
47 struct _XftFont *font;
49 short height;
50 short y;
51 short refCount;
52 char *name;
53 } W_Font;
56 typedef struct W_Pixmap {
57 struct W_Screen *screen;
58 Pixmap pixmap;
59 Pixmap mask;
60 unsigned short width;
61 unsigned short height;
62 short depth;
63 short refCount;
64 } W_Pixmap;
67 typedef struct W_Color {
68 struct W_Screen *screen;
70 XColor color;
71 unsigned short alpha;
72 short refCount;
73 GC gc;
74 struct {
75 unsigned int exact:1;
76 } flags;
77 } W_Color;
80 typedef struct W_FocusInfo {
81 struct W_View *toplevel;
82 struct W_View *focused; /* view that has the focus in this toplevel */
83 struct W_FocusInfo *next;
84 } W_FocusInfo;
88 typedef void* W_DndState(WMView *destView, XClientMessageEvent *event,
89 WMDraggingInfo *info);
92 typedef struct W_DragOperationItem {
93 WMDragOperationType type;
94 char* text;
95 } W_DragOperationItem;
98 typedef struct W_DragSourceInfo {
99 WMView *sourceView;
100 Window destinationWindow;
101 W_DndState *state;
102 WMSelectionProcs *selectionProcs;
103 Window icon;
104 WMPoint imageLocation;
105 WMPoint mouseOffset; /* mouse pos in icon */
106 Cursor dragCursor;
107 WMRect noPositionMessageZone;
108 Atom firstThreeTypes[3];
109 } W_DragSourceInfo;
112 typedef struct W_DragDestinationInfo {
113 WMView *destView;
114 WMView *xdndAwareView;
115 Window sourceWindow;
116 W_DndState *state;
117 Bool sourceActionChanged;
118 WMArray *sourceTypes;
119 WMArray *requiredTypes;
120 Bool typeListAvailable;
121 WMArray *dropDatas;
122 } W_DragDestinationInfo;
125 struct W_DraggingInfo {
126 unsigned char protocolVersion; /* version supported on the other side */
127 Time timestamp;
129 Atom sourceAction;
130 Atom destinationAction;
132 W_DragSourceInfo* sourceInfo; /* infos needed by source */
133 W_DragDestinationInfo* destInfo; /* infos needed by destination */
134 } W_DraggingInfo;
137 typedef struct W_Screen {
138 Display *display;
139 int screen;
140 int depth;
142 Colormap colormap;
144 Visual *visual;
146 Time lastEventTime;
148 Window rootWin;
150 struct W_View *rootView;
152 RContext *rcontext;
154 struct W_IMContext *imctx;
156 struct _XftDraw *xftdraw; /* shared XftDraw */
158 /* application related */
160 W_FocusInfo *focusInfo;
162 RImage *applicationIconImage; /* image (can have alpha channel) */
163 struct W_Pixmap *applicationIconPixmap; /* pixmap - no alpha channel */
164 Window applicationIconWindow;
166 struct W_Window *windowList; /* list of windows in the app */
168 Window groupLeader; /* the leader of the application */
169 /* also used for other things */
171 struct W_SelectionHandlers *selectionHandlerList;
173 struct {
174 unsigned int hasAppIcon:1;
175 unsigned int simpleApplication:1;
176 } aflags;
178 WMOpenPanel *sharedOpenPanel;
179 WMSavePanel *sharedSavePanel;
181 struct W_FontPanel *sharedFontPanel;
183 struct W_ColorPanel *sharedColorPanel;
185 Pixmap stipple;
187 struct W_View *dragSourceView;
188 struct W_DraggingInfo dragInfo;
190 /* colors */
191 W_Color *white;
192 W_Color *black;
193 W_Color *gray;
194 W_Color *darkGray;
196 GC stippleGC;
198 GC copyGC;
199 GC clipGC;
201 GC monoGC; /* GC for 1bpp visuals */
203 GC xorGC;
205 GC ixorGC; /* IncludeInferiors XOR */
207 GC drawStringGC; /* for WMDrawString() */
209 GC drawImStringGC; /* for WMDrawImageString() */
211 W_Font *normalFont;
213 W_Font *boldFont;
215 WMHashTable *fontCache;
217 Bool antialiasedText;
219 unsigned int ignoredModifierMask; /* modifiers to ignore when typing txt */
221 struct W_Balloon *balloon;
224 struct W_Pixmap *checkButtonImageOn;
225 struct W_Pixmap *checkButtonImageOff;
227 struct W_Pixmap *radioButtonImageOn;
228 struct W_Pixmap *radioButtonImageOff;
230 struct W_Pixmap *buttonArrow;
231 struct W_Pixmap *pushedButtonArrow;
233 struct W_Pixmap *scrollerDimple;
235 struct W_Pixmap *upArrow;
236 struct W_Pixmap *downArrow;
237 struct W_Pixmap *leftArrow;
238 struct W_Pixmap *rightArrow;
240 struct W_Pixmap *hiUpArrow;
241 struct W_Pixmap *hiDownArrow;
242 struct W_Pixmap *hiLeftArrow;
243 struct W_Pixmap *hiRightArrow;
245 struct W_Pixmap *pullDownIndicator;
246 struct W_Pixmap *popUpIndicator;
248 struct W_Pixmap *checkMark;
250 struct W_Pixmap *homeIcon;
251 struct W_Pixmap *altHomeIcon;
253 struct W_Pixmap *trashcanIcon;
254 struct W_Pixmap *altTrashcanIcon;
256 struct W_Pixmap *createDirIcon;
257 struct W_Pixmap *altCreateDirIcon;
259 struct W_Pixmap *disketteIcon;
260 struct W_Pixmap *altDisketteIcon;
261 struct W_Pixmap *unmountIcon;
262 struct W_Pixmap *altUnmountIcon;
264 struct W_Pixmap *magnifyIcon;
265 /*struct W_Pixmap *altMagnifyIcon;*/
266 struct W_Pixmap *wheelIcon;
267 struct W_Pixmap *grayIcon;
268 struct W_Pixmap *rgbIcon;
269 struct W_Pixmap *cmykIcon;
270 struct W_Pixmap *hsbIcon;
271 struct W_Pixmap *customPaletteIcon;
272 struct W_Pixmap *colorListIcon;
274 struct W_Pixmap *defaultObjectIcon;
276 Cursor defaultCursor;
278 Cursor textCursor;
280 Cursor invisibleCursor;
282 Atom attribsAtom; /* GNUstepWindowAttributes */
284 Atom deleteWindowAtom; /* WM_DELETE_WINDOW */
286 Atom protocolsAtom; /* _XA_WM_PROTOCOLS */
288 Atom clipboardAtom; /* CLIPBOARD */
290 Atom xdndAwareAtom; /* XdndAware */
291 Atom xdndSelectionAtom;
292 Atom xdndEnterAtom;
293 Atom xdndLeaveAtom;
294 Atom xdndPositionAtom;
295 Atom xdndDropAtom;
296 Atom xdndFinishedAtom;
297 Atom xdndTypeListAtom;
298 Atom xdndActionListAtom;
299 Atom xdndActionDescriptionAtom;
300 Atom xdndStatusAtom;
302 Atom xdndActionCopy;
303 Atom xdndActionMove;
304 Atom xdndActionLink;
305 Atom xdndActionAsk;
306 Atom xdndActionPrivate;
308 Atom wmIconDragOffsetAtom;
310 Atom wmStateAtom; /* WM_STATE */
312 Atom utf8String;
314 Atom netwmName;
315 Atom netwmIconName;
316 Atom netwmIcon;
318 /* stuff for detecting double-clicks */
319 Time lastClickTime; /* time of last mousedown event */
320 Window lastClickWindow; /* window of the last mousedown */
322 struct W_View *modalView;
323 unsigned modalLoop:1;
324 unsigned ignoreNextDoubleClick:1;
325 } W_Screen;
329 typedef struct W_ViewDelegate {
330 void *data;
332 void (*didMove)(struct W_ViewDelegate*, WMView*);
334 void (*didResize)(struct W_ViewDelegate*, WMView*);
336 void (*willMove)(struct W_ViewDelegate*, WMView*, int*, int*);
338 void (*willResize)(struct W_ViewDelegate*, WMView*,
339 unsigned int*, unsigned int*);
340 } W_ViewDelegate;
344 typedef struct W_View {
345 struct W_Screen *screen;
347 WMWidget *self; /* must point to the widget the view belongs to */
349 W_ViewDelegate *delegate;
351 Window window;
353 WMSize size;
355 short topOffs;
356 short leftOffs;
357 short bottomOffs;
358 short rightOffs;
360 WMPoint pos;
362 struct W_View *nextFocusChain; /* next/prev in focus chain */
363 struct W_View *prevFocusChain;
365 struct W_View *nextResponder; /* next to receive keyboard events */
367 struct W_View *parent; /* parent WMView */
369 struct W_View *childrenList; /* first in list of child windows */
371 struct W_View *nextSister; /* next on parent's children list */
373 WMArray *eventHandlers; /* event handlers for this window */
375 unsigned long attribFlags;
376 XSetWindowAttributes attribs;
378 void *hangedData; /* data holder for user program */
380 WMColor *backColor;
382 Cursor cursor;
384 Atom *droppableTypes;
385 struct W_DragSourceProcs *dragSourceProcs;
386 struct W_DragDestinationProcs *dragDestinationProcs;
387 WMPixmap *dragImage;
388 int helpContext;
390 XIC xic;
392 struct {
393 unsigned int realized:1;
394 unsigned int mapped:1;
395 unsigned int parentDying:1;
396 unsigned int dying:1; /* the view is being destroyed */
397 unsigned int topLevel:1; /* is a top level window */
398 unsigned int root:1; /* is the root window */
399 unsigned int mapWhenRealized:1; /* map the view when it's realized */
400 unsigned int alreadyDead:1; /* view was freed */
402 unsigned int dontCompressMotion:1; /* motion notify event compress */
403 unsigned int notifySizeChanged:1;
404 unsigned int dontCompressExpose:1; /* expose event compress */
406 /* toplevel only */
407 unsigned int worksWhenModal:1;
408 unsigned int pendingRelease1:1;
409 unsigned int pendingRelease2:1;
410 unsigned int pendingRelease3:1;
411 unsigned int pendingRelease4:1;
412 unsigned int pendingRelease5:1;
413 unsigned int xdndHintSet:1;
414 } flags;
416 int refCount;
417 } W_View;
420 typedef struct W_EventHandler {
421 unsigned long eventMask;
423 WMEventProc *proc;
425 void *clientData;
426 } W_EventHandler;
431 typedef struct _WINGsConfiguration {
432 char *systemFont;
433 char *boldSystemFont;
434 int defaultFontSize;
435 Bool antialiasedText;
436 char *floppyPath;
437 unsigned doubleClickDelay;
438 unsigned mouseWheelUp;
439 unsigned mouseWheelDown;
440 } _WINGsConfiguration;
442 extern _WINGsConfiguration WINGsConfiguration;
446 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
449 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
450 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
452 #define W_VIEW_REALIZED(view) (view)->flags.realized
453 #define W_VIEW_MAPPED(view) (view)->flags.mapped
455 #define W_VIEW_DISPLAY(view) (view)->screen->display
456 #define W_VIEW_SCREEN(view) (view)->screen
457 #define W_VIEW_DRAWABLE(view) (view)->window
459 #define W_VIEW_WIDTH(view) (view)->size.width
460 #define W_VIEW_HEIGHT(view) (view)->size.height
463 #define W_PIXEL(c) (c)->color.pixel
465 #define W_FONTID(f) (f)->font->fid
467 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
471 W_View *W_GetViewForXWindow(Display *display, Window window);
473 W_View *W_CreateView(W_View *parent);
475 W_View *W_CreateTopView(W_Screen *screen);
477 W_View *W_CreateUnmanagedTopView(W_Screen *screen);
480 W_View *W_CreateRootView(W_Screen *screen);
482 void W_DestroyView(W_View *view);
484 void W_RealizeView(W_View *view);
486 void W_ReparentView(W_View *view, W_View *newParent, int x, int y);
488 void W_RaiseView(W_View *view);
490 void W_LowerView(W_View *view);
493 void W_MapView(W_View *view);
495 void W_MapSubviews(W_View *view);
497 void W_UnmapSubviews(W_View *view);
499 W_View *W_TopLevelOfView(W_View *view);
501 void W_UnmapView(W_View *view);
503 void W_MoveView(W_View *view, int x, int y);
505 void W_ResizeView(W_View *view, unsigned int width, unsigned int height);
507 void W_SetViewBackgroundColor(W_View *view, WMColor *color);
509 void W_SetViewCursor(W_View *view, Cursor cursor);
511 void W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
512 unsigned int height, WMReliefType relief);
514 void W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y,
515 unsigned int width, unsigned int height,
516 WMReliefType relief,
517 GC black, GC dark, GC light, GC white);
519 void W_CallDestroyHandlers(W_View *view);
521 void W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor,
522 W_Font *font, WMReliefType relief, char *text,
523 WMAlignment alignment, W_Pixmap *image,
524 WMImagePosition position, WMColor *backColor, int ofs);
526 void W_PaintText(W_View *view, Drawable d, WMFont *font, int x, int y,
527 int width, WMAlignment alignment, WMColor *color,
528 int wrap, char *text, int length);
530 int W_GetTextHeight(WMFont *font, char *text, int width, int wrap);
533 int W_TextWidth(WMFont *font, char *text, int length);
536 void W_BroadcastMessage(W_View *targetParent, XEvent *event);
538 void W_DispatchMessage(W_View *target, XEvent *event);
540 void W_SetFocusOfToplevel(W_View *toplevel, W_View *view);
542 W_View *W_FocusedViewOfToplevel(W_View *view);
544 void W_SetFocusOfTopLevel(W_View *toplevel, W_View *view);
546 void W_ReleaseView(WMView *view);
548 WMView *W_RetainView(WMView *view);
550 void W_InitApplication(WMScreen *scr);
552 void W_InitNotificationCenter(void);
554 W_Class W_RegisterUserWidget(void);
556 void W_RedisplayView(WMView *view);
558 Bool W_ApplicationInitialized(void);
560 void W_HandleSelectionEvent(XEvent *event);
562 void W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event);
564 void W_FlushASAPNotificationQueue(void);
566 void W_FlushIdleNotificationQueue(void);
568 struct W_Balloon *W_CreateBalloon(WMScreen *scr);
570 void W_BalloonHandleEnterView(WMView *view);
572 void W_BalloonHandleLeaveView(WMView *view);
574 Bool W_CheckIdleHandlers(void);
576 void W_CheckTimerHandlers(void);
578 Bool W_HandleInputEvents(Bool waitForInput, int inputfd);
580 /* XDnD */
581 Atom W_OperationToAction(WMScreen *scr, WMDragOperationType operation);
583 WMDragOperationType W_ActionToOperation(WMScreen *scr, Atom action);
585 void W_FreeDragOperationItem(void* item);
587 Bool W_SendDnDClientMessage(Display *dpy, Window win, Atom message,
588 unsigned long data1, unsigned long data2,
589 unsigned long data3, unsigned long data4,
590 unsigned long data5);
592 void W_DragSourceStartTimer(WMDraggingInfo *info);
594 void W_DragSourceStopTimer(void);
596 void W_DragSourceStateHandler(WMDraggingInfo *info, XClientMessageEvent *event);
598 void W_DragDestinationStartTimer(WMDraggingInfo *info);
600 void W_DragDestinationStopTimer(void);
602 void W_DragDestinationStoreEnterMsgInfo(WMDraggingInfo *info, WMView *toplevel,
603 XClientMessageEvent *event);
605 void W_DragDestinationStorePositionMsgInfo(WMDraggingInfo *info,
606 WMView *toplevel,
607 XClientMessageEvent *event);
609 void W_DragDestinationCancelDropOnEnter(WMView *toplevel, WMDraggingInfo *info);
611 void W_DragDestinationStateHandler(WMDraggingInfo *info,
612 XClientMessageEvent *event);
614 void W_DragDestinationInfoClear(WMDraggingInfo *info);
616 void W_FreeViewXdndPart(WMView *view);
618 /* XIM */
619 void W_InitIM(WMScreen *scr);
621 void W_CreateIC(WMView *view);
623 void W_DestroyIC(WMView *view);
625 void W_FocusIC(WMView *view);
627 void W_UnFocusIC(WMView *view);
629 void W_SetPreeditPositon(W_View *view, int x, int y);
631 int W_LookupString(W_View *view, XKeyPressedEvent *event, char *buffer,
632 int buflen, KeySym *keysym, Status *status);
634 #ifdef __cplusplus
636 #endif /* __cplusplus */
638 #endif /* _WINGSP_H_ */