9 #include <WINGs/WINGs.h>
11 #if WINGS_H_VERSION < 20010117
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
;
59 unsigned int notFontSet
:1;
63 typedef struct W_Pixmap
{
64 struct W_Screen
*screen
;
68 unsigned short height
;
74 typedef struct W_Color
{
75 struct W_Screen
*screen
;
86 typedef struct W_FocusInfo
{
87 struct W_View
*toplevel
;
88 struct W_View
*focused
; /* view that has the focus in this toplevel */
89 struct W_FocusInfo
*next
;
94 struct W_DraggingInfo
{
95 Window destinationWindow
;
100 unsigned sourceOperation
;
102 WMPoint imageLocation
;
110 /* should be treated as internal data */
118 typedef struct W_Screen
{
131 struct W_View
*rootView
;
135 /* application related */
137 W_FocusInfo
*focusInfo
;
139 RImage
*applicationIconImage
; /* image (can have alpha channel) */
140 struct W_Pixmap
*applicationIconPixmap
; /* pixmap - no alpha channel */
141 Window applicationIconWindow
;
143 struct W_Window
*windowList
; /* list of windows in the app */
145 Window groupLeader
; /* the leader of the application */
146 /* also used for other things */
148 struct W_SelectionHandlers
*selectionHandlerList
;
151 unsigned int hasAppIcon
:1;
152 unsigned int simpleApplication
:1;
155 WMOpenPanel
*sharedOpenPanel
;
156 WMSavePanel
*sharedSavePanel
;
158 struct W_FontPanel
*sharedFontPanel
;
160 struct W_ColorPanel
*sharedColorPanel
;
164 struct W_View
*dragSourceView
;
165 struct W_DraggingInfo dragInfo
;
178 GC monoGC
; /* GC for 1bpp visuals */
182 GC ixorGC
; /* IncludeInferiors XOR */
190 WMHashTable
*fontCache
;
194 unsigned int ignoredModifierMask
; /* modifiers to ignore when typing txt */
196 struct W_Balloon
*balloon
;
199 struct W_Pixmap
*checkButtonImageOn
;
200 struct W_Pixmap
*checkButtonImageOff
;
202 struct W_Pixmap
*radioButtonImageOn
;
203 struct W_Pixmap
*radioButtonImageOff
;
205 struct W_Pixmap
*buttonArrow
;
206 struct W_Pixmap
*pushedButtonArrow
;
208 struct W_Pixmap
*scrollerDimple
;
210 struct W_Pixmap
*upArrow
;
211 struct W_Pixmap
*downArrow
;
212 struct W_Pixmap
*leftArrow
;
213 struct W_Pixmap
*rightArrow
;
215 struct W_Pixmap
*hiUpArrow
;
216 struct W_Pixmap
*hiDownArrow
;
217 struct W_Pixmap
*hiLeftArrow
;
218 struct W_Pixmap
*hiRightArrow
;
220 struct W_Pixmap
*pullDownIndicator
;
221 struct W_Pixmap
*popUpIndicator
;
223 struct W_Pixmap
*checkMark
;
225 struct W_Pixmap
*homeIcon
;
226 struct W_Pixmap
*altHomeIcon
;
228 struct W_Pixmap
*trashcanIcon
;
229 struct W_Pixmap
*altTrashcanIcon
;
231 struct W_Pixmap
*createDirIcon
;
232 struct W_Pixmap
*altCreateDirIcon
;
234 struct W_Pixmap
*disketteIcon
;
235 struct W_Pixmap
*altDisketteIcon
;
236 struct W_Pixmap
*unmountIcon
;
237 struct W_Pixmap
*altUnmountIcon
;
239 struct W_Pixmap
*magnifyIcon
;
240 /* struct W_Pixmap *altMagnifyIcon;*/
241 struct W_Pixmap
*wheelIcon
;
242 struct W_Pixmap
*grayIcon
;
243 struct W_Pixmap
*rgbIcon
;
244 struct W_Pixmap
*cmykIcon
;
245 struct W_Pixmap
*hsbIcon
;
246 struct W_Pixmap
*customPaletteIcon
;
247 struct W_Pixmap
*colorListIcon
;
249 struct W_Pixmap
*defaultObjectIcon
;
251 Cursor defaultCursor
;
255 Cursor invisibleCursor
;
257 Atom attribsAtom
; /* GNUstepWindowAttributes */
259 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
261 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
263 Atom clipboardAtom
; /* CLIPBOARD */
265 Atom xdndAwareAtom
; /* XdndAware */
266 Atom xdndSelectionAtom
;
269 Atom xdndPositionAtom
;
271 Atom xdndFinishedAtom
;
272 Atom xdndTypeListAtom
;
279 Atom xdndActionPrivate
;
281 Atom wmIconDragOffsetAtom
;
283 Atom wmStateAtom
; /* WM_STATE */
285 /* stuff for detecting double-clicks */
286 Time lastClickTime
; /* time of last mousedown event */
287 Window lastClickWindow
; /* window of the last mousedown */
289 struct W_View
*modalView
;
290 unsigned modalLoop
:1;
291 unsigned ignoreNextDoubleClick
:1;
296 typedef struct W_ViewDelegate
{
299 void (*didMove
)(struct W_ViewDelegate
*, WMView
*);
301 void (*didResize
)(struct W_ViewDelegate
*, WMView
*);
303 void (*willMove
)(struct W_ViewDelegate
*, WMView
*, int*, int*);
305 void (*willResize
)(struct W_ViewDelegate
*, WMView
*,
306 unsigned int*, unsigned int*);
311 typedef struct W_View
{
312 struct W_Screen
*screen
;
314 WMWidget
*self
; /* must point to the widget the
317 W_ViewDelegate
*delegate
;
330 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
331 struct W_View
*prevFocusChain
;
333 struct W_View
*nextResponder
; /* next to receive keyboard events */
335 struct W_View
*parent
; /* parent WMView */
337 struct W_View
*childrenList
; /* first in list of child windows */
339 struct W_View
*nextSister
; /* next on parent's children list */
341 WMArray
*eventHandlers
; /* event handlers for this window */
343 unsigned long attribFlags
;
344 XSetWindowAttributes attribs
;
346 void *hangedData
; /* data holder for user program */
352 Atom
*droppableTypes
;
353 struct W_DragSourceProcs
*dragSourceProcs
;
354 struct W_DragDestinationProcs
*dragDestinationProcs
;
359 unsigned int realized
:1;
360 unsigned int mapped
:1;
361 unsigned int parentDying
:1;
362 unsigned int dying
:1; /* the view is being destroyed */
363 unsigned int topLevel
:1; /* is a top level window */
364 unsigned int root
:1; /* is the root window */
365 unsigned int mapWhenRealized
:1;/* map the view when it's realized */
366 unsigned int alreadyDead
:1; /* view was freed */
368 unsigned int dontCompressMotion
:1; /* motion notify event compress */
369 unsigned int notifySizeChanged
:1;
370 unsigned int dontCompressExpose
:1; /* will compress all expose
373 unsigned int worksWhenModal
:1;
374 unsigned int pendingRelease1
:1;
375 unsigned int pendingRelease2
:1;
376 unsigned int pendingRelease3
:1;
377 unsigned int pendingRelease4
:1;
378 unsigned int pendingRelease5
:1;
379 unsigned int xdndHintSet
:1;
386 typedef struct W_EventHandler
{
387 unsigned long eventMask
;
397 typedef struct _WINGsConfiguration
{
399 char *boldSystemFont
;
403 unsigned doubleClickDelay
;
404 unsigned mouseWheelUp
;
405 unsigned mouseWheelDown
;
406 } _WINGsConfiguration
;
408 extern _WINGsConfiguration WINGsConfiguration
;
412 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
415 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
416 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
418 #define W_VIEW_REALIZED(view) (view)->flags.realized
419 #define W_VIEW_MAPPED(view) (view)->flags.mapped
421 #define W_VIEW_DISPLAY(view) (view)->screen->display
422 #define W_VIEW_SCREEN(view) (view)->screen
423 #define W_VIEW_DRAWABLE(view) (view)->window
425 #define W_VIEW_WIDTH(view) (view)->size.width
426 #define W_VIEW_HEIGHT(view) (view)->size.height
429 #define W_PIXEL(c) (c)->color.pixel
431 #define W_FONTID(f) (f)->font->fid
433 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
437 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
439 W_View
*W_CreateView(W_View
*parent
);
441 W_View
*W_CreateTopView(W_Screen
*screen
);
443 W_View
*W_CreateUnmanagedTopView(W_Screen
*screen
);
446 W_View
*W_CreateRootView(W_Screen
*screen
);
448 void W_DestroyView(W_View
*view
);
450 void W_RealizeView(W_View
*view
);
452 void W_ReparentView(W_View
*view
, W_View
*newParent
, int x
, int y
);
454 void W_RaiseView(W_View
*view
);
456 void W_LowerView(W_View
*view
);
459 void W_MapView(W_View
*view
);
461 void W_MapSubviews(W_View
*view
);
463 void W_UnmapSubviews(W_View
*view
);
465 W_View
*W_TopLevelOfView(W_View
*view
);
467 void W_UnmapView(W_View
*view
);
469 void W_MoveView(W_View
*view
, int x
, int y
);
471 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
473 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
475 void W_SetViewCursor(W_View
*view
, Cursor cursor
);
477 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
478 unsigned int height
, WMReliefType relief
);
480 void W_DrawReliefWithGC(W_Screen
*scr
, Drawable d
, int x
, int y
,
481 unsigned int width
, unsigned int height
,
483 GC black
, GC dark
, GC light
, GC white
);
485 void W_CallDestroyHandlers(W_View
*view
);
487 void W_PaintTextAndImage(W_View
*view
, int wrap
, GC textGC
, W_Font
*font
,
488 WMReliefType relief
, char *text
,
489 WMAlignment alignment
, W_Pixmap
*image
,
490 WMImagePosition position
, GC backGC
, int ofs
);
492 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
493 int width
, WMAlignment alignment
, GC gc
,
494 int wrap
, char *text
, int length
);
496 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
499 int W_TextWidth(WMFont
*font
, char *text
, int length
);
502 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
504 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
506 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
508 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
510 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
512 void W_ReleaseView(WMView
*view
);
514 WMView
*W_RetainView(WMView
*view
);
516 void W_InitApplication(WMScreen
*scr
);
518 void W_InitNotificationCenter(void);
520 W_Class
W_RegisterUserWidget(void);
522 void W_RedisplayView(WMView
*view
);
524 Bool
W_ApplicationInitialized(void);
526 void W_HandleSelectionEvent(XEvent
*event
);
528 void W_HandleDNDClientMessage(WMView
*toplevel
, XClientMessageEvent
*event
);
530 void W_FlushASAPNotificationQueue(void);
532 void W_FlushIdleNotificationQueue(void);
534 struct W_Balloon
*W_CreateBalloon(WMScreen
*scr
);
536 void W_BalloonHandleEnterView(WMView
*view
);
538 void W_BalloonHandleLeaveView(WMView
*view
);
540 Bool
W_CheckIdleHandlers(void);
542 void W_CheckTimerHandlers(void);
544 Bool
W_HandleInputEvents(Bool waitForInput
, int inputfd
);
548 #endif /* __cplusplus */
550 #endif /* _WINGSP_H_ */