configure: Removed deprecated lines for unused X stuff
[wmaker-crm.git] / WINGs / WINGs / WINGsP.h
blobde014124d66f36ee1df7b3ff764995c3d06beffd
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 */
26 /* ---[ global settigns ]------------------------------------------------- */
28 #define DOUBLE_BUFFER 1
30 #define SCROLLER_WIDTH 20
32 typedef struct _WINGsConfiguration {
33 char *systemFont;
34 char *boldSystemFont;
35 int defaultFontSize;
36 Bool antialiasedText;
37 char *floppyPath;
38 unsigned doubleClickDelay;
39 unsigned mouseWheelUp;
40 unsigned mouseWheelDown;
41 } _WINGsConfiguration;
43 extern char *_WINGS_progname;
44 extern _WINGsConfiguration WINGsConfiguration;
45 extern struct W_Application WMApplication;
48 /* ---[ drag*.c ]--------------------------------------------------------- */
51 * We need to define these structure first because they are used in W_Screen
52 * below. The rest of drag-related stuff if after because it needs W_Screen
54 #define XDND_VERSION 3
56 typedef struct W_DraggingInfo {
57 unsigned char protocolVersion; /* version supported on the other side */
58 Time timestamp;
60 Atom sourceAction;
61 Atom destinationAction;
63 struct W_DragSourceInfo* sourceInfo; /* infos needed by source */
64 struct W_DragDestinationInfo* destInfo; /* infos needed by destination */
65 } W_DraggingInfo;
67 /* ---[ Structures from WINGs.h ]----------------------------------------- */
69 /* Pre-definition of internal structs */
70 typedef struct W_Color W_Color;
71 typedef struct W_Pixmap W_Pixmap;
72 typedef struct W_View W_View;
74 typedef struct W_FocusInfo {
75 W_View *toplevel;
76 W_View *focused; /* view that has the focus in this toplevel */
77 struct W_FocusInfo *next;
78 } W_FocusInfo;
80 typedef struct W_Screen {
81 Display *display;
82 int screen;
83 int depth;
85 Colormap colormap;
87 Visual *visual;
89 Time lastEventTime;
91 Window rootWin;
93 W_View *rootView;
95 RContext *rcontext;
97 struct W_IMContext *imctx;
99 struct _XftDraw *xftdraw; /* shared XftDraw */
101 /* application related */
103 W_FocusInfo *focusInfo;
105 RImage *applicationIconImage; /* image (can have alpha channel) */
106 W_Pixmap *applicationIconPixmap; /* pixmap - no alpha channel */
107 Window applicationIconWindow;
109 struct W_Window *windowList; /* list of windows in the app */
111 Window groupLeader; /* the leader of the application */
112 /* also used for other things */
114 struct W_SelectionHandlers *selectionHandlerList;
116 struct {
117 unsigned int hasAppIcon:1;
118 unsigned int simpleApplication:1;
119 } aflags;
121 WMOpenPanel *sharedOpenPanel;
122 WMSavePanel *sharedSavePanel;
124 struct W_FontPanel *sharedFontPanel;
126 struct W_ColorPanel *sharedColorPanel;
128 Pixmap stipple;
130 W_View *dragSourceView;
131 W_DraggingInfo dragInfo;
133 /* colors */
134 W_Color *white;
135 W_Color *black;
136 W_Color *gray;
137 W_Color *darkGray;
139 GC stippleGC;
141 GC copyGC;
142 GC clipGC;
144 GC monoGC; /* GC for 1bpp visuals */
146 GC xorGC;
148 GC ixorGC; /* IncludeInferiors XOR */
150 GC drawStringGC; /* for WMDrawString() */
152 GC drawImStringGC; /* for WMDrawImageString() */
154 struct W_Font *normalFont;
156 struct W_Font *boldFont;
158 WMHashTable *fontCache;
160 Bool antialiasedText;
162 unsigned int ignoredModifierMask; /* modifiers to ignore when typing txt */
164 struct W_Balloon *balloon;
167 W_Pixmap *checkButtonImageOn;
168 W_Pixmap *checkButtonImageOff;
170 W_Pixmap *radioButtonImageOn;
171 W_Pixmap *radioButtonImageOff;
173 W_Pixmap *buttonArrow;
174 W_Pixmap *pushedButtonArrow;
176 W_Pixmap *scrollerDimple;
178 W_Pixmap *upArrow;
179 W_Pixmap *downArrow;
180 W_Pixmap *leftArrow;
181 W_Pixmap *rightArrow;
183 W_Pixmap *hiUpArrow;
184 W_Pixmap *hiDownArrow;
185 W_Pixmap *hiLeftArrow;
186 W_Pixmap *hiRightArrow;
188 W_Pixmap *pullDownIndicator;
189 W_Pixmap *popUpIndicator;
191 W_Pixmap *checkMark;
193 W_Pixmap *homeIcon;
194 W_Pixmap *altHomeIcon;
196 W_Pixmap *trashcanIcon;
197 W_Pixmap *altTrashcanIcon;
199 W_Pixmap *createDirIcon;
200 W_Pixmap *altCreateDirIcon;
202 W_Pixmap *disketteIcon;
203 W_Pixmap *altDisketteIcon;
204 W_Pixmap *unmountIcon;
205 W_Pixmap *altUnmountIcon;
207 W_Pixmap *magnifyIcon;
208 /*W_Pixmap *altMagnifyIcon;*/
209 W_Pixmap *wheelIcon;
210 W_Pixmap *grayIcon;
211 W_Pixmap *rgbIcon;
212 W_Pixmap *cmykIcon;
213 W_Pixmap *hsbIcon;
214 W_Pixmap *customPaletteIcon;
215 W_Pixmap *colorListIcon;
217 W_Pixmap *defaultObjectIcon;
219 Cursor defaultCursor;
221 Cursor textCursor;
223 Cursor invisibleCursor;
225 Atom attribsAtom; /* GNUstepWindowAttributes */
227 Atom deleteWindowAtom; /* WM_DELETE_WINDOW */
229 Atom protocolsAtom; /* _XA_WM_PROTOCOLS */
231 Atom clipboardAtom; /* CLIPBOARD */
233 Atom xdndAwareAtom; /* XdndAware */
234 Atom xdndSelectionAtom;
235 Atom xdndEnterAtom;
236 Atom xdndLeaveAtom;
237 Atom xdndPositionAtom;
238 Atom xdndDropAtom;
239 Atom xdndFinishedAtom;
240 Atom xdndTypeListAtom;
241 Atom xdndActionListAtom;
242 Atom xdndActionDescriptionAtom;
243 Atom xdndStatusAtom;
245 Atom xdndActionCopy;
246 Atom xdndActionMove;
247 Atom xdndActionLink;
248 Atom xdndActionAsk;
249 Atom xdndActionPrivate;
251 Atom wmIconDragOffsetAtom;
253 Atom wmStateAtom; /* WM_STATE */
255 Atom utf8String;
257 Atom netwmName;
258 Atom netwmIconName;
259 Atom netwmIcon;
261 /* stuff for detecting double-clicks */
262 Time lastClickTime; /* time of last mousedown event */
263 Window lastClickWindow; /* window of the last mousedown */
265 struct W_View *modalView;
266 unsigned modalLoop:1;
267 unsigned ignoreNextDoubleClick:1;
268 } W_Screen;
270 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
273 /* ---[ configuration.c ]------------------------------------------------- */
275 void W_ReadConfigurations(void);
278 /* ---[ drag*.c ]--------------------------------------------------------- */
280 typedef struct W_DragOperationItem {
281 WMDragOperationType type;
282 char* text;
283 } W_DragOperationItem;
285 typedef void* W_DndState(WMView *destView, XClientMessageEvent *event,
286 WMDraggingInfo *info);
288 typedef struct W_DragSourceInfo {
289 WMView *sourceView;
290 Window destinationWindow;
291 W_DndState *state;
292 WMSelectionProcs *selectionProcs;
293 Window icon;
294 WMPoint imageLocation;
295 WMPoint mouseOffset; /* mouse pos in icon */
296 Cursor dragCursor;
297 WMRect noPositionMessageZone;
298 Atom firstThreeTypes[3];
299 } W_DragSourceInfo;
301 typedef struct W_DragDestinationInfo {
302 WMView *destView;
303 WMView *xdndAwareView;
304 Window sourceWindow;
305 W_DndState *state;
306 Bool sourceActionChanged;
307 WMArray *sourceTypes;
308 WMArray *requiredTypes;
309 Bool typeListAvailable;
310 WMArray *dropDatas;
311 } W_DragDestinationInfo;
313 /* -- Functions -- */
315 void W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event);
317 Atom W_OperationToAction(WMScreen *scr, WMDragOperationType operation);
319 WMDragOperationType W_ActionToOperation(WMScreen *scr, Atom action);
321 void W_FreeDragOperationItem(void* item);
323 Bool W_SendDnDClientMessage(Display *dpy, Window win, Atom message,
324 unsigned long data1, unsigned long data2,
325 unsigned long data3, unsigned long data4,
326 unsigned long data5);
328 void W_DragSourceStartTimer(WMDraggingInfo *info);
330 void W_DragSourceStopTimer(void);
332 void W_DragSourceStateHandler(WMDraggingInfo *info, XClientMessageEvent *event);
334 void W_DragDestinationStartTimer(WMDraggingInfo *info);
336 void W_DragDestinationStopTimer(void);
338 void W_DragDestinationStoreEnterMsgInfo(WMDraggingInfo *info, WMView *toplevel,
339 XClientMessageEvent *event);
341 void W_DragDestinationStorePositionMsgInfo(WMDraggingInfo *info,
342 WMView *toplevel,
343 XClientMessageEvent *event);
345 void W_DragDestinationCancelDropOnEnter(WMView *toplevel, WMDraggingInfo *info);
347 void W_DragDestinationStateHandler(WMDraggingInfo *info,
348 XClientMessageEvent *event);
350 void W_DragDestinationInfoClear(WMDraggingInfo *info);
352 void W_FreeViewXdndPart(WMView *view);
355 /* ---[ handlers.c ]------------------------------------------------------ */
357 Bool W_CheckIdleHandlers(void);
359 void W_CheckTimerHandlers(void);
361 Bool W_HandleInputEvents(Bool waitForInput, int inputfd);
364 /* ---[ notification.c ]-------------------------------------------------- */
366 void W_InitNotificationCenter(void);
368 void W_FlushASAPNotificationQueue(void);
370 void W_FlushIdleNotificationQueue(void);
373 /* ---[ selection.c ]----------------------------------------------------- */
375 void W_HandleSelectionEvent(XEvent *event);
378 /* ---[ wapplication.c ]-------------------------------------------------- */
380 typedef struct W_Application {
381 char *applicationName;
382 int argc;
383 char **argv;
384 char *resourcePath;
385 } W_Application;
387 /* -- Functions -- */
389 void W_InitApplication(WMScreen *scr);
391 Bool W_ApplicationInitialized(void);
394 /* ---[ wballoon.c ]------------------------------------------------------ */
396 struct W_Balloon *W_CreateBalloon(WMScreen *scr);
398 void W_BalloonHandleEnterView(WMView *view);
400 void W_BalloonHandleLeaveView(WMView *view);
403 /* ---[ wcolor.c ]-------------------------------------------------------- */
405 struct W_Color {
406 struct W_Screen *screen;
408 XColor color;
409 unsigned short alpha;
410 short refCount;
411 GC gc;
412 struct {
413 unsigned int exact:1;
414 } flags;
417 #define W_PIXEL(c) (c)->color.pixel
420 /* ---[ wevent.c ]-------------------------------------------------------- */
422 typedef struct W_EventHandler {
423 unsigned long eventMask;
425 WMEventProc *proc;
427 void *clientData;
428 } W_EventHandler;
430 /* -- Functions -- */
432 void W_CallDestroyHandlers(W_View *view);
435 /* ---[ wfont.c ]--------------------------------------------------------- */
437 typedef struct W_Font {
438 struct W_Screen *screen;
440 struct _XftFont *font;
442 short height;
443 short y;
444 short refCount;
445 char *name;
446 } W_Font;
448 #define W_FONTID(f) (f)->font->fid
451 /* ---[ widgets.c ]------------------------------------------------------- */
453 #define WC_UserWidget 128
455 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
457 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
458 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
460 /* -- Functions -- */
462 W_Class W_RegisterUserWidget(void);
465 /* ---[ winputmethod.c ]-------------------------------------------------- */
467 void W_InitIM(WMScreen *scr);
469 void W_CreateIC(WMView *view);
471 void W_DestroyIC(WMView *view);
473 void W_FocusIC(WMView *view);
475 void W_UnFocusIC(WMView *view);
477 void W_SetPreeditPositon(W_View *view, int x, int y);
479 int W_LookupString(W_View *view, XKeyPressedEvent *event, char *buffer,
480 int buflen, KeySym *keysym, Status *status);
483 /* ---[ wmisc.c ]--------------------------------------------------------- */
485 void W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
486 unsigned int height, WMReliefType relief);
488 void W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y,
489 unsigned int width, unsigned int height,
490 WMReliefType relief,
491 GC black, GC dark, GC light, GC white);
493 void W_PaintTextAndImage(W_View *view, int wrap, WMColor *textColor,
494 W_Font *font, WMReliefType relief, const char *text,
495 WMAlignment alignment, W_Pixmap *image,
496 WMImagePosition position, WMColor *backColor, int ofs);
498 void W_PaintText(W_View *view, Drawable d, WMFont *font, int x, int y,
499 int width, WMAlignment alignment, WMColor *color,
500 int wrap, const char *text, int length);
502 int W_GetTextHeight(WMFont *font, const char *text, int width, int wrap);
505 /* ---[ wpixmap.c ]------------------------------------------------------- */
507 struct W_Pixmap {
508 struct W_Screen *screen;
509 Pixmap pixmap;
510 Pixmap mask;
511 unsigned short width;
512 unsigned short height;
513 short depth;
514 short refCount;
518 /* ---[ wview.c ]--------------------------------------------------------- */
520 typedef struct W_ViewDelegate {
521 void *data;
522 void (*didMove)(struct W_ViewDelegate*, WMView*);
523 void (*didResize)(struct W_ViewDelegate*, WMView*);
524 void (*willMove)(struct W_ViewDelegate*, WMView*, int*, int*);
525 void (*willResize)(struct W_ViewDelegate*, WMView*,
526 unsigned int*, unsigned int*);
527 } W_ViewDelegate;
529 struct W_View {
530 struct W_Screen *screen;
532 WMWidget *self; /* must point to the widget the view belongs to */
534 W_ViewDelegate *delegate;
536 Window window;
538 WMSize size;
540 short topOffs;
541 short leftOffs;
542 short bottomOffs;
543 short rightOffs;
545 WMPoint pos;
547 struct W_View *nextFocusChain; /* next/prev in focus chain */
548 struct W_View *prevFocusChain;
550 struct W_View *nextResponder; /* next to receive keyboard events */
552 struct W_View *parent; /* parent WMView */
554 struct W_View *childrenList; /* first in list of child windows */
556 struct W_View *nextSister; /* next on parent's children list */
558 WMArray *eventHandlers; /* event handlers for this window */
560 unsigned long attribFlags;
561 XSetWindowAttributes attribs;
563 void *hangedData; /* data holder for user program */
565 WMColor *backColor;
567 Cursor cursor;
569 Atom *droppableTypes;
570 struct W_DragSourceProcs *dragSourceProcs;
571 struct W_DragDestinationProcs *dragDestinationProcs;
572 WMPixmap *dragImage;
573 int helpContext;
575 XIC xic;
577 struct {
578 unsigned int realized:1;
579 unsigned int mapped:1;
580 unsigned int parentDying:1;
581 unsigned int dying:1; /* the view is being destroyed */
582 unsigned int topLevel:1; /* is a top level window */
583 unsigned int root:1; /* is the root window */
584 unsigned int mapWhenRealized:1; /* map the view when it's realized */
585 unsigned int alreadyDead:1; /* view was freed */
587 unsigned int dontCompressMotion:1; /* motion notify event compress */
588 unsigned int notifySizeChanged:1;
589 unsigned int dontCompressExpose:1; /* expose event compress */
591 /* toplevel only */
592 unsigned int worksWhenModal:1;
593 unsigned int pendingRelease1:1;
594 unsigned int pendingRelease2:1;
595 unsigned int pendingRelease3:1;
596 unsigned int pendingRelease4:1;
597 unsigned int pendingRelease5:1;
598 unsigned int xdndHintSet:1;
599 } flags;
601 int refCount;
604 #define W_VIEW_REALIZED(view) (view)->flags.realized
605 #define W_VIEW_MAPPED(view) (view)->flags.mapped
607 #define W_VIEW_DISPLAY(view) (view)->screen->display
608 #define W_VIEW_SCREEN(view) (view)->screen
609 #define W_VIEW_DRAWABLE(view) (view)->window
611 #define W_VIEW_WIDTH(view) (view)->size.width
612 #define W_VIEW_HEIGHT(view) (view)->size.height
614 /* -- Functions -- */
616 W_View *W_GetViewForXWindow(Display *display, Window window);
618 W_View *W_CreateView(W_View *parent);
620 W_View *W_CreateTopView(W_Screen *screen);
622 W_View *W_CreateUnmanagedTopView(W_Screen *screen);
624 W_View *W_CreateRootView(W_Screen *screen);
626 void W_DestroyView(W_View *view);
628 void W_RealizeView(W_View *view);
630 void W_RedisplayView(WMView *view);
632 void W_ReparentView(W_View *view, W_View *newParent, int x, int y);
634 void W_RaiseView(W_View *view);
636 void W_LowerView(W_View *view);
638 void W_MapView(W_View *view);
640 void W_MapSubviews(W_View *view);
642 void W_UnmapSubviews(W_View *view);
644 W_View *W_TopLevelOfView(W_View *view);
646 void W_UnmapView(W_View *view);
648 WMView *W_RetainView(WMView *view);
650 void W_ReleaseView(WMView *view);
652 void W_MoveView(W_View *view, int x, int y);
654 void W_ResizeView(W_View *view, unsigned int width, unsigned int height);
656 void W_SetViewBackgroundColor(W_View *view, WMColor *color);
658 void W_SetViewCursor(W_View *view, Cursor cursor);
660 void W_SetFocusOfTopLevel(W_View *toplevel, W_View *view);
662 W_View *W_FocusedViewOfToplevel(W_View *view);
664 void W_BroadcastMessage(W_View *targetParent, XEvent *event);
666 void W_DispatchMessage(W_View *target, XEvent *event);
669 #ifdef __cplusplus
671 #endif /* __cplusplus */
673 #endif /* _WINGSP_H_ */