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
;
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 struct _XftDraw
*xftdraw
; /* shared XftDraw */
142 Bool hasXftSupport
; /* if it can antialias text */
144 /* application related */
146 W_FocusInfo
*focusInfo
;
148 RImage
*applicationIconImage
; /* image (can have alpha channel) */
149 struct W_Pixmap
*applicationIconPixmap
; /* pixmap - no alpha channel */
150 Window applicationIconWindow
;
152 struct W_Window
*windowList
; /* list of windows in the app */
154 Window groupLeader
; /* the leader of the application */
155 /* also used for other things */
157 struct W_SelectionHandlers
*selectionHandlerList
;
160 unsigned int hasAppIcon
:1;
161 unsigned int simpleApplication
:1;
164 WMOpenPanel
*sharedOpenPanel
;
165 WMSavePanel
*sharedSavePanel
;
167 struct W_FontPanel
*sharedFontPanel
;
169 struct W_ColorPanel
*sharedColorPanel
;
173 struct W_View
*dragSourceView
;
174 struct W_DraggingInfo dragInfo
;
187 GC monoGC
; /* GC for 1bpp visuals */
191 GC ixorGC
; /* IncludeInferiors XOR */
193 GC drawStringGC
; /* for WMDrawString() */
195 GC drawImStringGC
; /* for WMDrawImageString() */
201 WMHashTable
*fontCache
;
203 WMHashTable
*xftFontCache
;
205 WMHashTable
*fontSetCache
;
207 WMHashTable
*xftFontSetCache
;
211 Bool antialiasedText
;
213 unsigned int ignoredModifierMask
; /* modifiers to ignore when typing txt */
215 struct W_Balloon
*balloon
;
218 struct W_Pixmap
*checkButtonImageOn
;
219 struct W_Pixmap
*checkButtonImageOff
;
221 struct W_Pixmap
*radioButtonImageOn
;
222 struct W_Pixmap
*radioButtonImageOff
;
224 struct W_Pixmap
*buttonArrow
;
225 struct W_Pixmap
*pushedButtonArrow
;
227 struct W_Pixmap
*scrollerDimple
;
229 struct W_Pixmap
*upArrow
;
230 struct W_Pixmap
*downArrow
;
231 struct W_Pixmap
*leftArrow
;
232 struct W_Pixmap
*rightArrow
;
234 struct W_Pixmap
*hiUpArrow
;
235 struct W_Pixmap
*hiDownArrow
;
236 struct W_Pixmap
*hiLeftArrow
;
237 struct W_Pixmap
*hiRightArrow
;
239 struct W_Pixmap
*pullDownIndicator
;
240 struct W_Pixmap
*popUpIndicator
;
242 struct W_Pixmap
*checkMark
;
244 struct W_Pixmap
*homeIcon
;
245 struct W_Pixmap
*altHomeIcon
;
247 struct W_Pixmap
*trashcanIcon
;
248 struct W_Pixmap
*altTrashcanIcon
;
250 struct W_Pixmap
*createDirIcon
;
251 struct W_Pixmap
*altCreateDirIcon
;
253 struct W_Pixmap
*disketteIcon
;
254 struct W_Pixmap
*altDisketteIcon
;
255 struct W_Pixmap
*unmountIcon
;
256 struct W_Pixmap
*altUnmountIcon
;
258 struct W_Pixmap
*magnifyIcon
;
259 /* struct W_Pixmap *altMagnifyIcon;*/
260 struct W_Pixmap
*wheelIcon
;
261 struct W_Pixmap
*grayIcon
;
262 struct W_Pixmap
*rgbIcon
;
263 struct W_Pixmap
*cmykIcon
;
264 struct W_Pixmap
*hsbIcon
;
265 struct W_Pixmap
*customPaletteIcon
;
266 struct W_Pixmap
*colorListIcon
;
268 struct W_Pixmap
*defaultObjectIcon
;
270 Cursor defaultCursor
;
274 Cursor invisibleCursor
;
276 Atom attribsAtom
; /* GNUstepWindowAttributes */
278 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
280 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
282 Atom clipboardAtom
; /* CLIPBOARD */
284 Atom xdndAwareAtom
; /* XdndAware */
285 Atom xdndSelectionAtom
;
288 Atom xdndPositionAtom
;
290 Atom xdndFinishedAtom
;
291 Atom xdndTypeListAtom
;
298 Atom xdndActionPrivate
;
300 Atom wmIconDragOffsetAtom
;
302 Atom wmStateAtom
; /* WM_STATE */
304 /* stuff for detecting double-clicks */
305 Time lastClickTime
; /* time of last mousedown event */
306 Window lastClickWindow
; /* window of the last mousedown */
308 struct W_View
*modalView
;
309 unsigned modalLoop
:1;
310 unsigned ignoreNextDoubleClick
:1;
315 typedef struct W_ViewDelegate
{
318 void (*didMove
)(struct W_ViewDelegate
*, WMView
*);
320 void (*didResize
)(struct W_ViewDelegate
*, WMView
*);
322 void (*willMove
)(struct W_ViewDelegate
*, WMView
*, int*, int*);
324 void (*willResize
)(struct W_ViewDelegate
*, WMView
*,
325 unsigned int*, unsigned int*);
330 typedef struct W_View
{
331 struct W_Screen
*screen
;
333 WMWidget
*self
; /* must point to the widget the
336 W_ViewDelegate
*delegate
;
349 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
350 struct W_View
*prevFocusChain
;
352 struct W_View
*nextResponder
; /* next to receive keyboard events */
354 struct W_View
*parent
; /* parent WMView */
356 struct W_View
*childrenList
; /* first in list of child windows */
358 struct W_View
*nextSister
; /* next on parent's children list */
360 WMArray
*eventHandlers
; /* event handlers for this window */
362 unsigned long attribFlags
;
363 XSetWindowAttributes attribs
;
365 void *hangedData
; /* data holder for user program */
371 Atom
*droppableTypes
;
372 struct W_DragSourceProcs
*dragSourceProcs
;
373 struct W_DragDestinationProcs
*dragDestinationProcs
;
378 unsigned int realized
:1;
379 unsigned int mapped
:1;
380 unsigned int parentDying
:1;
381 unsigned int dying
:1; /* the view is being destroyed */
382 unsigned int topLevel
:1; /* is a top level window */
383 unsigned int root
:1; /* is the root window */
384 unsigned int mapWhenRealized
:1;/* map the view when it's realized */
385 unsigned int alreadyDead
:1; /* view was freed */
387 unsigned int dontCompressMotion
:1; /* motion notify event compress */
388 unsigned int notifySizeChanged
:1;
389 unsigned int dontCompressExpose
:1; /* will compress all expose
392 unsigned int worksWhenModal
:1;
393 unsigned int pendingRelease1
:1;
394 unsigned int pendingRelease2
:1;
395 unsigned int pendingRelease3
:1;
396 unsigned int pendingRelease4
:1;
397 unsigned int pendingRelease5
:1;
398 unsigned int xdndHintSet
:1;
405 typedef struct W_EventHandler
{
406 unsigned long eventMask
;
416 typedef struct _WINGsConfiguration
{
418 char *boldSystemFont
;
419 char *antialiasedSystemFont
;
420 char *antialiasedBoldSystemFont
;
422 Bool antialiasedText
;
425 unsigned doubleClickDelay
;
426 unsigned mouseWheelUp
;
427 unsigned mouseWheelDown
;
428 } _WINGsConfiguration
;
430 extern _WINGsConfiguration WINGsConfiguration
;
434 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
437 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
438 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
440 #define W_VIEW_REALIZED(view) (view)->flags.realized
441 #define W_VIEW_MAPPED(view) (view)->flags.mapped
443 #define W_VIEW_DISPLAY(view) (view)->screen->display
444 #define W_VIEW_SCREEN(view) (view)->screen
445 #define W_VIEW_DRAWABLE(view) (view)->window
447 #define W_VIEW_WIDTH(view) (view)->size.width
448 #define W_VIEW_HEIGHT(view) (view)->size.height
451 #define W_PIXEL(c) (c)->color.pixel
453 #define W_FONTID(f) (f)->font->fid
455 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
459 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
461 W_View
*W_CreateView(W_View
*parent
);
463 W_View
*W_CreateTopView(W_Screen
*screen
);
465 W_View
*W_CreateUnmanagedTopView(W_Screen
*screen
);
468 W_View
*W_CreateRootView(W_Screen
*screen
);
470 void W_DestroyView(W_View
*view
);
472 void W_RealizeView(W_View
*view
);
474 void W_ReparentView(W_View
*view
, W_View
*newParent
, int x
, int y
);
476 void W_RaiseView(W_View
*view
);
478 void W_LowerView(W_View
*view
);
481 void W_MapView(W_View
*view
);
483 void W_MapSubviews(W_View
*view
);
485 void W_UnmapSubviews(W_View
*view
);
487 W_View
*W_TopLevelOfView(W_View
*view
);
489 void W_UnmapView(W_View
*view
);
491 void W_MoveView(W_View
*view
, int x
, int y
);
493 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
495 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
497 void W_SetViewCursor(W_View
*view
, Cursor cursor
);
499 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
500 unsigned int height
, WMReliefType relief
);
502 void W_DrawReliefWithGC(W_Screen
*scr
, Drawable d
, int x
, int y
,
503 unsigned int width
, unsigned int height
,
505 GC black
, GC dark
, GC light
, GC white
);
507 void W_CallDestroyHandlers(W_View
*view
);
509 void W_PaintTextAndImage(W_View
*view
, int wrap
, WMColor
*textColor
,
510 W_Font
*font
, WMReliefType relief
, char *text
,
511 WMAlignment alignment
, W_Pixmap
*image
,
512 WMImagePosition position
, WMColor
*backColor
, int ofs
);
514 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
515 int width
, WMAlignment alignment
, WMColor
*color
,
516 int wrap
, char *text
, int length
);
518 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
521 int W_TextWidth(WMFont
*font
, char *text
, int length
);
524 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
526 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
528 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
530 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
532 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
534 void W_ReleaseView(WMView
*view
);
536 WMView
*W_RetainView(WMView
*view
);
538 void W_InitApplication(WMScreen
*scr
);
540 void W_InitNotificationCenter(void);
542 W_Class
W_RegisterUserWidget(void);
544 void W_RedisplayView(WMView
*view
);
546 Bool
W_ApplicationInitialized(void);
548 void W_HandleSelectionEvent(XEvent
*event
);
550 void W_HandleDNDClientMessage(WMView
*toplevel
, XClientMessageEvent
*event
);
552 void W_FlushASAPNotificationQueue(void);
554 void W_FlushIdleNotificationQueue(void);
556 struct W_Balloon
*W_CreateBalloon(WMScreen
*scr
);
558 void W_BalloonHandleEnterView(WMView
*view
);
560 void W_BalloonHandleLeaveView(WMView
*view
);
562 Bool
W_CheckIdleHandlers(void);
564 void W_CheckTimerHandlers(void);
566 Bool
W_HandleInputEvents(Bool waitForInput
, int inputfd
);
570 #endif /* __cplusplus */
572 #endif /* _WINGSP_H_ */