9 #include <WINGs/WINGs.h>
11 #if WINGS_H_VERSION < 20021124
12 #error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
23 #endif /* __cplusplus */
29 #define WC_UserWidget 128
33 #define SCROLLER_WIDTH 20
37 #define XDND_VERSION 4
40 typedef struct W_Application
{
41 char *applicationName
;
48 typedef struct W_Font
{
49 struct W_Screen
*screen
;
52 struct _XftFont
*font
;
63 //unsigned int notFontSet:1;
64 //unsigned int antialiased:1;
68 typedef struct W_Pixmap
{
69 struct W_Screen
*screen
;
73 unsigned short height
;
79 typedef struct W_Color
{
80 struct W_Screen
*screen
;
92 typedef struct W_FocusInfo
{
93 struct W_View
*toplevel
;
94 struct W_View
*focused
; /* view that has the focus in this toplevel */
95 struct W_FocusInfo
*next
;
100 struct W_DraggingInfo
{
101 Window destinationWindow
;
106 unsigned sourceOperation
;
108 WMPoint imageLocation
;
116 /* should be treated as internal data */
124 typedef struct W_Screen
{
137 struct W_View
*rootView
;
141 struct W_IMContext
*imctx
;
143 struct _XftDraw
*xftdraw
; /* shared XftDraw */
145 /* application related */
147 W_FocusInfo
*focusInfo
;
149 RImage
*applicationIconImage
; /* image (can have alpha channel) */
150 struct W_Pixmap
*applicationIconPixmap
; /* pixmap - no alpha channel */
151 Window applicationIconWindow
;
153 struct W_Window
*windowList
; /* list of windows in the app */
155 Window groupLeader
; /* the leader of the application */
156 /* also used for other things */
158 struct W_SelectionHandlers
*selectionHandlerList
;
161 unsigned int hasAppIcon
:1;
162 unsigned int simpleApplication
:1;
165 WMOpenPanel
*sharedOpenPanel
;
166 WMSavePanel
*sharedSavePanel
;
168 struct W_FontPanel
*sharedFontPanel
;
170 struct W_ColorPanel
*sharedColorPanel
;
174 struct W_View
*dragSourceView
;
175 struct W_DraggingInfo dragInfo
;
188 GC monoGC
; /* GC for 1bpp visuals */
192 GC ixorGC
; /* IncludeInferiors XOR */
194 GC drawStringGC
; /* for WMDrawString() */
196 GC drawImStringGC
; /* for WMDrawImageString() */
202 WMHashTable
*fontCache
;
206 Bool antialiasedText
;
208 unsigned int ignoredModifierMask
; /* modifiers to ignore when typing txt */
210 struct W_Balloon
*balloon
;
213 struct W_Pixmap
*checkButtonImageOn
;
214 struct W_Pixmap
*checkButtonImageOff
;
216 struct W_Pixmap
*radioButtonImageOn
;
217 struct W_Pixmap
*radioButtonImageOff
;
219 struct W_Pixmap
*buttonArrow
;
220 struct W_Pixmap
*pushedButtonArrow
;
222 struct W_Pixmap
*scrollerDimple
;
224 struct W_Pixmap
*upArrow
;
225 struct W_Pixmap
*downArrow
;
226 struct W_Pixmap
*leftArrow
;
227 struct W_Pixmap
*rightArrow
;
229 struct W_Pixmap
*hiUpArrow
;
230 struct W_Pixmap
*hiDownArrow
;
231 struct W_Pixmap
*hiLeftArrow
;
232 struct W_Pixmap
*hiRightArrow
;
234 struct W_Pixmap
*pullDownIndicator
;
235 struct W_Pixmap
*popUpIndicator
;
237 struct W_Pixmap
*checkMark
;
239 struct W_Pixmap
*homeIcon
;
240 struct W_Pixmap
*altHomeIcon
;
242 struct W_Pixmap
*trashcanIcon
;
243 struct W_Pixmap
*altTrashcanIcon
;
245 struct W_Pixmap
*createDirIcon
;
246 struct W_Pixmap
*altCreateDirIcon
;
248 struct W_Pixmap
*disketteIcon
;
249 struct W_Pixmap
*altDisketteIcon
;
250 struct W_Pixmap
*unmountIcon
;
251 struct W_Pixmap
*altUnmountIcon
;
253 struct W_Pixmap
*magnifyIcon
;
254 /* struct W_Pixmap *altMagnifyIcon;*/
255 struct W_Pixmap
*wheelIcon
;
256 struct W_Pixmap
*grayIcon
;
257 struct W_Pixmap
*rgbIcon
;
258 struct W_Pixmap
*cmykIcon
;
259 struct W_Pixmap
*hsbIcon
;
260 struct W_Pixmap
*customPaletteIcon
;
261 struct W_Pixmap
*colorListIcon
;
263 struct W_Pixmap
*defaultObjectIcon
;
265 Cursor defaultCursor
;
269 Cursor invisibleCursor
;
271 Atom attribsAtom
; /* GNUstepWindowAttributes */
273 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
275 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
277 Atom clipboardAtom
; /* CLIPBOARD */
279 Atom xdndAwareAtom
; /* XdndAware */
280 Atom xdndSelectionAtom
;
283 Atom xdndPositionAtom
;
285 Atom xdndFinishedAtom
;
286 Atom xdndTypeListAtom
;
293 Atom xdndActionPrivate
;
295 Atom wmIconDragOffsetAtom
;
297 Atom wmStateAtom
; /* WM_STATE */
299 /* stuff for detecting double-clicks */
300 Time lastClickTime
; /* time of last mousedown event */
301 Window lastClickWindow
; /* window of the last mousedown */
303 struct W_View
*modalView
;
304 unsigned modalLoop
:1;
305 unsigned ignoreNextDoubleClick
:1;
310 typedef struct W_ViewDelegate
{
313 void (*didMove
)(struct W_ViewDelegate
*, WMView
*);
315 void (*didResize
)(struct W_ViewDelegate
*, WMView
*);
317 void (*willMove
)(struct W_ViewDelegate
*, WMView
*, int*, int*);
319 void (*willResize
)(struct W_ViewDelegate
*, WMView
*,
320 unsigned int*, unsigned int*);
325 typedef struct W_View
{
326 struct W_Screen
*screen
;
328 WMWidget
*self
; /* must point to the widget the
331 W_ViewDelegate
*delegate
;
344 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
345 struct W_View
*prevFocusChain
;
347 struct W_View
*nextResponder
; /* next to receive keyboard events */
349 struct W_View
*parent
; /* parent WMView */
351 struct W_View
*childrenList
; /* first in list of child windows */
353 struct W_View
*nextSister
; /* next on parent's children list */
355 WMArray
*eventHandlers
; /* event handlers for this window */
357 unsigned long attribFlags
;
358 XSetWindowAttributes attribs
;
360 void *hangedData
; /* data holder for user program */
366 Atom
*droppableTypes
;
367 struct W_DragSourceProcs
*dragSourceProcs
;
368 struct W_DragDestinationProcs
*dragDestinationProcs
;
373 unsigned int realized
:1;
374 unsigned int mapped
:1;
375 unsigned int parentDying
:1;
376 unsigned int dying
:1; /* the view is being destroyed */
377 unsigned int topLevel
:1; /* is a top level window */
378 unsigned int root
:1; /* is the root window */
379 unsigned int mapWhenRealized
:1;/* map the view when it's realized */
380 unsigned int alreadyDead
:1; /* view was freed */
382 unsigned int dontCompressMotion
:1; /* motion notify event compress */
383 unsigned int notifySizeChanged
:1;
384 unsigned int dontCompressExpose
:1; /* will compress all expose
387 unsigned int worksWhenModal
:1;
388 unsigned int pendingRelease1
:1;
389 unsigned int pendingRelease2
:1;
390 unsigned int pendingRelease3
:1;
391 unsigned int pendingRelease4
:1;
392 unsigned int pendingRelease5
:1;
393 unsigned int xdndHintSet
:1;
400 typedef struct W_EventHandler
{
401 unsigned long eventMask
;
411 typedef struct _WINGsConfiguration
{
413 char *boldSystemFont
;
415 Bool antialiasedText
;
418 unsigned doubleClickDelay
;
419 unsigned mouseWheelUp
;
420 unsigned mouseWheelDown
;
421 } _WINGsConfiguration
;
423 extern _WINGsConfiguration WINGsConfiguration
;
427 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
430 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
431 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
433 #define W_VIEW_REALIZED(view) (view)->flags.realized
434 #define W_VIEW_MAPPED(view) (view)->flags.mapped
436 #define W_VIEW_DISPLAY(view) (view)->screen->display
437 #define W_VIEW_SCREEN(view) (view)->screen
438 #define W_VIEW_DRAWABLE(view) (view)->window
440 #define W_VIEW_WIDTH(view) (view)->size.width
441 #define W_VIEW_HEIGHT(view) (view)->size.height
444 #define W_PIXEL(c) (c)->color.pixel
446 #define W_FONTID(f) (f)->font->fid
448 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
452 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
454 W_View
*W_CreateView(W_View
*parent
);
456 W_View
*W_CreateTopView(W_Screen
*screen
);
458 W_View
*W_CreateUnmanagedTopView(W_Screen
*screen
);
461 W_View
*W_CreateRootView(W_Screen
*screen
);
463 void W_DestroyView(W_View
*view
);
465 void W_RealizeView(W_View
*view
);
467 void W_ReparentView(W_View
*view
, W_View
*newParent
, int x
, int y
);
469 void W_RaiseView(W_View
*view
);
471 void W_LowerView(W_View
*view
);
474 void W_MapView(W_View
*view
);
476 void W_MapSubviews(W_View
*view
);
478 void W_UnmapSubviews(W_View
*view
);
480 W_View
*W_TopLevelOfView(W_View
*view
);
482 void W_UnmapView(W_View
*view
);
484 void W_MoveView(W_View
*view
, int x
, int y
);
486 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
488 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
490 void W_SetViewCursor(W_View
*view
, Cursor cursor
);
492 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
493 unsigned int height
, WMReliefType relief
);
495 void W_DrawReliefWithGC(W_Screen
*scr
, Drawable d
, int x
, int y
,
496 unsigned int width
, unsigned int height
,
498 GC black
, GC dark
, GC light
, GC white
);
500 void W_CallDestroyHandlers(W_View
*view
);
502 void W_PaintTextAndImage(W_View
*view
, int wrap
, WMColor
*textColor
,
503 W_Font
*font
, WMReliefType relief
, char *text
,
504 WMAlignment alignment
, W_Pixmap
*image
,
505 WMImagePosition position
, WMColor
*backColor
, int ofs
);
507 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
508 int width
, WMAlignment alignment
, WMColor
*color
,
509 int wrap
, char *text
, int length
);
511 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
514 int W_TextWidth(WMFont
*font
, char *text
, int length
);
517 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
519 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
521 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
523 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
525 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
527 void W_ReleaseView(WMView
*view
);
529 WMView
*W_RetainView(WMView
*view
);
531 void W_InitApplication(WMScreen
*scr
);
533 void W_InitNotificationCenter(void);
535 W_Class
W_RegisterUserWidget(void);
537 void W_RedisplayView(WMView
*view
);
539 Bool
W_ApplicationInitialized(void);
541 void W_HandleSelectionEvent(XEvent
*event
);
543 void W_HandleDNDClientMessage(WMView
*toplevel
, XClientMessageEvent
*event
);
545 void W_FlushASAPNotificationQueue(void);
547 void W_FlushIdleNotificationQueue(void);
549 struct W_Balloon
*W_CreateBalloon(WMScreen
*scr
);
551 void W_BalloonHandleEnterView(WMView
*view
);
553 void W_BalloonHandleLeaveView(WMView
*view
);
555 Bool
W_CheckIdleHandlers(void);
557 void W_CheckTimerHandlers(void);
559 Bool
W_HandleInputEvents(Bool waitForInput
, int inputfd
);
563 #endif /* __cplusplus */
565 #endif /* _WINGSP_H_ */