9 #include <WINGs/WINGs.h>
11 #if WINGS_H_VERSION < 20021008
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
;
60 unsigned int notFontSet
:1;
61 unsigned int antialiased
:1;
65 typedef struct W_Pixmap
{
66 struct W_Screen
*screen
;
70 unsigned short height
;
76 typedef struct W_Color
{
77 struct W_Screen
*screen
;
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
;
97 struct W_DraggingInfo
{
98 Window destinationWindow
;
103 unsigned sourceOperation
;
105 WMPoint imageLocation
;
113 /* should be treated as internal data */
121 typedef struct W_Screen
{
134 struct W_View
*rootView
;
138 struct W_IMContext
*imctx
;
140 /* application related */
142 W_FocusInfo
*focusInfo
;
144 RImage
*applicationIconImage
; /* image (can have alpha channel) */
145 struct W_Pixmap
*applicationIconPixmap
; /* pixmap - no alpha channel */
146 Window applicationIconWindow
;
148 struct W_Window
*windowList
; /* list of windows in the app */
150 Window groupLeader
; /* the leader of the application */
151 /* also used for other things */
153 struct W_SelectionHandlers
*selectionHandlerList
;
156 unsigned int hasAppIcon
:1;
157 unsigned int simpleApplication
:1;
160 WMOpenPanel
*sharedOpenPanel
;
161 WMSavePanel
*sharedSavePanel
;
163 struct W_FontPanel
*sharedFontPanel
;
165 struct W_ColorPanel
*sharedColorPanel
;
169 struct W_View
*dragSourceView
;
170 struct W_DraggingInfo dragInfo
;
183 GC monoGC
; /* GC for 1bpp visuals */
187 GC ixorGC
; /* IncludeInferiors XOR */
189 GC drawStringGC
; /* for WMDrawString() */
191 GC drawImStringGC
; /* for WMDrawImageString() */
197 WMHashTable
*fontCache
;
199 WMHashTable
*fontSetCache
;
203 Bool antialiasedText
;
205 unsigned int ignoredModifierMask
; /* modifiers to ignore when typing txt */
207 struct W_Balloon
*balloon
;
210 struct W_Pixmap
*checkButtonImageOn
;
211 struct W_Pixmap
*checkButtonImageOff
;
213 struct W_Pixmap
*radioButtonImageOn
;
214 struct W_Pixmap
*radioButtonImageOff
;
216 struct W_Pixmap
*buttonArrow
;
217 struct W_Pixmap
*pushedButtonArrow
;
219 struct W_Pixmap
*scrollerDimple
;
221 struct W_Pixmap
*upArrow
;
222 struct W_Pixmap
*downArrow
;
223 struct W_Pixmap
*leftArrow
;
224 struct W_Pixmap
*rightArrow
;
226 struct W_Pixmap
*hiUpArrow
;
227 struct W_Pixmap
*hiDownArrow
;
228 struct W_Pixmap
*hiLeftArrow
;
229 struct W_Pixmap
*hiRightArrow
;
231 struct W_Pixmap
*pullDownIndicator
;
232 struct W_Pixmap
*popUpIndicator
;
234 struct W_Pixmap
*checkMark
;
236 struct W_Pixmap
*homeIcon
;
237 struct W_Pixmap
*altHomeIcon
;
239 struct W_Pixmap
*trashcanIcon
;
240 struct W_Pixmap
*altTrashcanIcon
;
242 struct W_Pixmap
*createDirIcon
;
243 struct W_Pixmap
*altCreateDirIcon
;
245 struct W_Pixmap
*disketteIcon
;
246 struct W_Pixmap
*altDisketteIcon
;
247 struct W_Pixmap
*unmountIcon
;
248 struct W_Pixmap
*altUnmountIcon
;
250 struct W_Pixmap
*magnifyIcon
;
251 /* struct W_Pixmap *altMagnifyIcon;*/
252 struct W_Pixmap
*wheelIcon
;
253 struct W_Pixmap
*grayIcon
;
254 struct W_Pixmap
*rgbIcon
;
255 struct W_Pixmap
*cmykIcon
;
256 struct W_Pixmap
*hsbIcon
;
257 struct W_Pixmap
*customPaletteIcon
;
258 struct W_Pixmap
*colorListIcon
;
260 struct W_Pixmap
*defaultObjectIcon
;
262 Cursor defaultCursor
;
266 Cursor invisibleCursor
;
268 Atom attribsAtom
; /* GNUstepWindowAttributes */
270 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
272 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
274 Atom clipboardAtom
; /* CLIPBOARD */
276 Atom xdndAwareAtom
; /* XdndAware */
277 Atom xdndSelectionAtom
;
280 Atom xdndPositionAtom
;
282 Atom xdndFinishedAtom
;
283 Atom xdndTypeListAtom
;
290 Atom xdndActionPrivate
;
292 Atom wmIconDragOffsetAtom
;
294 Atom wmStateAtom
; /* WM_STATE */
296 /* stuff for detecting double-clicks */
297 Time lastClickTime
; /* time of last mousedown event */
298 Window lastClickWindow
; /* window of the last mousedown */
300 struct W_View
*modalView
;
301 unsigned modalLoop
:1;
302 unsigned ignoreNextDoubleClick
:1;
307 typedef struct W_ViewDelegate
{
310 void (*didMove
)(struct W_ViewDelegate
*, WMView
*);
312 void (*didResize
)(struct W_ViewDelegate
*, WMView
*);
314 void (*willMove
)(struct W_ViewDelegate
*, WMView
*, int*, int*);
316 void (*willResize
)(struct W_ViewDelegate
*, WMView
*,
317 unsigned int*, unsigned int*);
322 typedef struct W_View
{
323 struct W_Screen
*screen
;
325 WMWidget
*self
; /* must point to the widget the
328 W_ViewDelegate
*delegate
;
341 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
342 struct W_View
*prevFocusChain
;
344 struct W_View
*nextResponder
; /* next to receive keyboard events */
346 struct W_View
*parent
; /* parent WMView */
348 struct W_View
*childrenList
; /* first in list of child windows */
350 struct W_View
*nextSister
; /* next on parent's children list */
352 WMArray
*eventHandlers
; /* event handlers for this window */
354 unsigned long attribFlags
;
355 XSetWindowAttributes attribs
;
357 void *hangedData
; /* data holder for user program */
363 Atom
*droppableTypes
;
364 struct W_DragSourceProcs
*dragSourceProcs
;
365 struct W_DragDestinationProcs
*dragDestinationProcs
;
370 unsigned int realized
:1;
371 unsigned int mapped
:1;
372 unsigned int parentDying
:1;
373 unsigned int dying
:1; /* the view is being destroyed */
374 unsigned int topLevel
:1; /* is a top level window */
375 unsigned int root
:1; /* is the root window */
376 unsigned int mapWhenRealized
:1;/* map the view when it's realized */
377 unsigned int alreadyDead
:1; /* view was freed */
379 unsigned int dontCompressMotion
:1; /* motion notify event compress */
380 unsigned int notifySizeChanged
:1;
381 unsigned int dontCompressExpose
:1; /* will compress all expose
384 unsigned int worksWhenModal
:1;
385 unsigned int pendingRelease1
:1;
386 unsigned int pendingRelease2
:1;
387 unsigned int pendingRelease3
:1;
388 unsigned int pendingRelease4
:1;
389 unsigned int pendingRelease5
:1;
390 unsigned int xdndHintSet
:1;
397 typedef struct W_EventHandler
{
398 unsigned long eventMask
;
408 typedef struct _WINGsConfiguration
{
410 char *boldSystemFont
;
412 char *aaBoldSystemFont
;
414 Bool antialiasedText
;
417 unsigned doubleClickDelay
;
418 unsigned mouseWheelUp
;
419 unsigned mouseWheelDown
;
420 } _WINGsConfiguration
;
422 extern _WINGsConfiguration WINGsConfiguration
;
426 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
429 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
430 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
432 #define W_VIEW_REALIZED(view) (view)->flags.realized
433 #define W_VIEW_MAPPED(view) (view)->flags.mapped
435 #define W_VIEW_DISPLAY(view) (view)->screen->display
436 #define W_VIEW_SCREEN(view) (view)->screen
437 #define W_VIEW_DRAWABLE(view) (view)->window
439 #define W_VIEW_WIDTH(view) (view)->size.width
440 #define W_VIEW_HEIGHT(view) (view)->size.height
443 #define W_PIXEL(c) (c)->color.pixel
445 #define W_FONTID(f) (f)->font->fid
447 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
451 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
453 W_View
*W_CreateView(W_View
*parent
);
455 W_View
*W_CreateTopView(W_Screen
*screen
);
457 W_View
*W_CreateUnmanagedTopView(W_Screen
*screen
);
460 W_View
*W_CreateRootView(W_Screen
*screen
);
462 void W_DestroyView(W_View
*view
);
464 void W_RealizeView(W_View
*view
);
466 void W_ReparentView(W_View
*view
, W_View
*newParent
, int x
, int y
);
468 void W_RaiseView(W_View
*view
);
470 void W_LowerView(W_View
*view
);
473 void W_MapView(W_View
*view
);
475 void W_MapSubviews(W_View
*view
);
477 void W_UnmapSubviews(W_View
*view
);
479 W_View
*W_TopLevelOfView(W_View
*view
);
481 void W_UnmapView(W_View
*view
);
483 void W_MoveView(W_View
*view
, int x
, int y
);
485 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
487 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
489 void W_SetViewCursor(W_View
*view
, Cursor cursor
);
491 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
492 unsigned int height
, WMReliefType relief
);
494 void W_DrawReliefWithGC(W_Screen
*scr
, Drawable d
, int x
, int y
,
495 unsigned int width
, unsigned int height
,
497 GC black
, GC dark
, GC light
, GC white
);
499 void W_CallDestroyHandlers(W_View
*view
);
501 void W_PaintTextAndImage(W_View
*view
, int wrap
, WMColor
*textColor
,
502 W_Font
*font
, WMReliefType relief
, char *text
,
503 WMAlignment alignment
, W_Pixmap
*image
,
504 WMImagePosition position
, WMColor
*backColor
, int ofs
);
506 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
507 int width
, WMAlignment alignment
, WMColor
*color
,
508 int wrap
, char *text
, int length
);
510 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
513 int W_TextWidth(WMFont
*font
, char *text
, int length
);
516 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
518 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
520 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
522 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
524 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
526 void W_ReleaseView(WMView
*view
);
528 WMView
*W_RetainView(WMView
*view
);
530 void W_InitApplication(WMScreen
*scr
);
532 void W_InitNotificationCenter(void);
534 W_Class
W_RegisterUserWidget(void);
536 void W_RedisplayView(WMView
*view
);
538 Bool
W_ApplicationInitialized(void);
540 void W_HandleSelectionEvent(XEvent
*event
);
542 void W_HandleDNDClientMessage(WMView
*toplevel
, XClientMessageEvent
*event
);
544 void W_FlushASAPNotificationQueue(void);
546 void W_FlushIdleNotificationQueue(void);
548 struct W_Balloon
*W_CreateBalloon(WMScreen
*scr
);
550 void W_BalloonHandleEnterView(WMView
*view
);
552 void W_BalloonHandleLeaveView(WMView
*view
);
554 Bool
W_CheckIdleHandlers(void);
556 void W_CheckTimerHandlers(void);
558 Bool
W_HandleInputEvents(Bool waitForInput
, int inputfd
);
562 #endif /* __cplusplus */
564 #endif /* _WINGSP_H_ */