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 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
;
209 Bool antialiasedText
;
211 unsigned int ignoredModifierMask
; /* modifiers to ignore when typing txt */
213 struct W_Balloon
*balloon
;
216 struct W_Pixmap
*checkButtonImageOn
;
217 struct W_Pixmap
*checkButtonImageOff
;
219 struct W_Pixmap
*radioButtonImageOn
;
220 struct W_Pixmap
*radioButtonImageOff
;
222 struct W_Pixmap
*buttonArrow
;
223 struct W_Pixmap
*pushedButtonArrow
;
225 struct W_Pixmap
*scrollerDimple
;
227 struct W_Pixmap
*upArrow
;
228 struct W_Pixmap
*downArrow
;
229 struct W_Pixmap
*leftArrow
;
230 struct W_Pixmap
*rightArrow
;
232 struct W_Pixmap
*hiUpArrow
;
233 struct W_Pixmap
*hiDownArrow
;
234 struct W_Pixmap
*hiLeftArrow
;
235 struct W_Pixmap
*hiRightArrow
;
237 struct W_Pixmap
*pullDownIndicator
;
238 struct W_Pixmap
*popUpIndicator
;
240 struct W_Pixmap
*checkMark
;
242 struct W_Pixmap
*homeIcon
;
243 struct W_Pixmap
*altHomeIcon
;
245 struct W_Pixmap
*trashcanIcon
;
246 struct W_Pixmap
*altTrashcanIcon
;
248 struct W_Pixmap
*createDirIcon
;
249 struct W_Pixmap
*altCreateDirIcon
;
251 struct W_Pixmap
*disketteIcon
;
252 struct W_Pixmap
*altDisketteIcon
;
253 struct W_Pixmap
*unmountIcon
;
254 struct W_Pixmap
*altUnmountIcon
;
256 struct W_Pixmap
*magnifyIcon
;
257 /* struct W_Pixmap *altMagnifyIcon;*/
258 struct W_Pixmap
*wheelIcon
;
259 struct W_Pixmap
*grayIcon
;
260 struct W_Pixmap
*rgbIcon
;
261 struct W_Pixmap
*cmykIcon
;
262 struct W_Pixmap
*hsbIcon
;
263 struct W_Pixmap
*customPaletteIcon
;
264 struct W_Pixmap
*colorListIcon
;
266 struct W_Pixmap
*defaultObjectIcon
;
268 Cursor defaultCursor
;
272 Cursor invisibleCursor
;
274 Atom attribsAtom
; /* GNUstepWindowAttributes */
276 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
278 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
280 Atom clipboardAtom
; /* CLIPBOARD */
282 Atom xdndAwareAtom
; /* XdndAware */
283 Atom xdndSelectionAtom
;
286 Atom xdndPositionAtom
;
288 Atom xdndFinishedAtom
;
289 Atom xdndTypeListAtom
;
296 Atom xdndActionPrivate
;
298 Atom wmIconDragOffsetAtom
;
300 Atom wmStateAtom
; /* WM_STATE */
302 /* stuff for detecting double-clicks */
303 Time lastClickTime
; /* time of last mousedown event */
304 Window lastClickWindow
; /* window of the last mousedown */
306 struct W_View
*modalView
;
307 unsigned modalLoop
:1;
308 unsigned ignoreNextDoubleClick
:1;
313 typedef struct W_ViewDelegate
{
316 void (*didMove
)(struct W_ViewDelegate
*, WMView
*);
318 void (*didResize
)(struct W_ViewDelegate
*, WMView
*);
320 void (*willMove
)(struct W_ViewDelegate
*, WMView
*, int*, int*);
322 void (*willResize
)(struct W_ViewDelegate
*, WMView
*,
323 unsigned int*, unsigned int*);
328 typedef struct W_View
{
329 struct W_Screen
*screen
;
331 WMWidget
*self
; /* must point to the widget the
334 W_ViewDelegate
*delegate
;
347 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
348 struct W_View
*prevFocusChain
;
350 struct W_View
*nextResponder
; /* next to receive keyboard events */
352 struct W_View
*parent
; /* parent WMView */
354 struct W_View
*childrenList
; /* first in list of child windows */
356 struct W_View
*nextSister
; /* next on parent's children list */
358 WMArray
*eventHandlers
; /* event handlers for this window */
360 unsigned long attribFlags
;
361 XSetWindowAttributes attribs
;
363 void *hangedData
; /* data holder for user program */
369 Atom
*droppableTypes
;
370 struct W_DragSourceProcs
*dragSourceProcs
;
371 struct W_DragDestinationProcs
*dragDestinationProcs
;
376 unsigned int realized
:1;
377 unsigned int mapped
:1;
378 unsigned int parentDying
:1;
379 unsigned int dying
:1; /* the view is being destroyed */
380 unsigned int topLevel
:1; /* is a top level window */
381 unsigned int root
:1; /* is the root window */
382 unsigned int mapWhenRealized
:1;/* map the view when it's realized */
383 unsigned int alreadyDead
:1; /* view was freed */
385 unsigned int dontCompressMotion
:1; /* motion notify event compress */
386 unsigned int notifySizeChanged
:1;
387 unsigned int dontCompressExpose
:1; /* will compress all expose
390 unsigned int worksWhenModal
:1;
391 unsigned int pendingRelease1
:1;
392 unsigned int pendingRelease2
:1;
393 unsigned int pendingRelease3
:1;
394 unsigned int pendingRelease4
:1;
395 unsigned int pendingRelease5
:1;
396 unsigned int xdndHintSet
:1;
403 typedef struct W_EventHandler
{
404 unsigned long eventMask
;
414 typedef struct _WINGsConfiguration
{
416 char *boldSystemFont
;
417 char *antialiasedSystemFont
;
418 char *antialiasedBoldSystemFont
;
420 Bool antialiasedText
;
423 unsigned doubleClickDelay
;
424 unsigned mouseWheelUp
;
425 unsigned mouseWheelDown
;
426 } _WINGsConfiguration
;
428 extern _WINGsConfiguration WINGsConfiguration
;
432 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
435 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
436 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
438 #define W_VIEW_REALIZED(view) (view)->flags.realized
439 #define W_VIEW_MAPPED(view) (view)->flags.mapped
441 #define W_VIEW_DISPLAY(view) (view)->screen->display
442 #define W_VIEW_SCREEN(view) (view)->screen
443 #define W_VIEW_DRAWABLE(view) (view)->window
445 #define W_VIEW_WIDTH(view) (view)->size.width
446 #define W_VIEW_HEIGHT(view) (view)->size.height
449 #define W_PIXEL(c) (c)->color.pixel
451 #define W_FONTID(f) (f)->font->fid
453 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
457 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
459 W_View
*W_CreateView(W_View
*parent
);
461 W_View
*W_CreateTopView(W_Screen
*screen
);
463 W_View
*W_CreateUnmanagedTopView(W_Screen
*screen
);
466 W_View
*W_CreateRootView(W_Screen
*screen
);
468 void W_DestroyView(W_View
*view
);
470 void W_RealizeView(W_View
*view
);
472 void W_ReparentView(W_View
*view
, W_View
*newParent
, int x
, int y
);
474 void W_RaiseView(W_View
*view
);
476 void W_LowerView(W_View
*view
);
479 void W_MapView(W_View
*view
);
481 void W_MapSubviews(W_View
*view
);
483 void W_UnmapSubviews(W_View
*view
);
485 W_View
*W_TopLevelOfView(W_View
*view
);
487 void W_UnmapView(W_View
*view
);
489 void W_MoveView(W_View
*view
, int x
, int y
);
491 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
493 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
495 void W_SetViewCursor(W_View
*view
, Cursor cursor
);
497 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
498 unsigned int height
, WMReliefType relief
);
500 void W_DrawReliefWithGC(W_Screen
*scr
, Drawable d
, int x
, int y
,
501 unsigned int width
, unsigned int height
,
503 GC black
, GC dark
, GC light
, GC white
);
505 void W_CallDestroyHandlers(W_View
*view
);
507 void W_PaintTextAndImage(W_View
*view
, int wrap
, WMColor
*textColor
,
508 W_Font
*font
, WMReliefType relief
, char *text
,
509 WMAlignment alignment
, W_Pixmap
*image
,
510 WMImagePosition position
, WMColor
*backColor
, int ofs
);
512 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
513 int width
, WMAlignment alignment
, WMColor
*color
,
514 int wrap
, char *text
, int length
);
516 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
519 int W_TextWidth(WMFont
*font
, char *text
, int length
);
522 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
524 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
526 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
528 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
530 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
532 void W_ReleaseView(WMView
*view
);
534 WMView
*W_RetainView(WMView
*view
);
536 void W_InitApplication(WMScreen
*scr
);
538 void W_InitNotificationCenter(void);
540 W_Class
W_RegisterUserWidget(void);
542 void W_RedisplayView(WMView
*view
);
544 Bool
W_ApplicationInitialized(void);
546 void W_HandleSelectionEvent(XEvent
*event
);
548 void W_HandleDNDClientMessage(WMView
*toplevel
, XClientMessageEvent
*event
);
550 void W_FlushASAPNotificationQueue(void);
552 void W_FlushIdleNotificationQueue(void);
554 struct W_Balloon
*W_CreateBalloon(WMScreen
*scr
);
556 void W_BalloonHandleEnterView(WMView
*view
);
558 void W_BalloonHandleLeaveView(WMView
*view
);
560 Bool
W_CheckIdleHandlers(void);
562 void W_CheckTimerHandlers(void);
564 Bool
W_HandleInputEvents(Bool waitForInput
, int inputfd
);
568 #endif /* __cplusplus */
570 #endif /* _WINGSP_H_ */