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 struct W_Pixmap
*applicationIcon
;
140 Window applicationIconWindow
;
142 struct W_Window
*windowList
; /* list of windows in the app */
144 Window groupLeader
; /* the leader of the application */
145 /* also used for other things */
147 struct W_SelectionHandlers
*selectionHandlerList
;
150 unsigned int hasAppIcon
:1;
151 unsigned int simpleApplication
:1;
154 WMOpenPanel
*sharedOpenPanel
;
155 WMSavePanel
*sharedSavePanel
;
157 struct W_FontPanel
*sharedFontPanel
;
159 struct W_ColorPanel
*sharedColorPanel
;
163 struct W_View
*dragSourceView
;
164 struct W_DraggingInfo dragInfo
;
177 GC monoGC
; /* GC for 1bpp visuals */
181 GC ixorGC
; /* IncludeInferiors XOR */
189 WMHashTable
*fontCache
;
193 struct W_Balloon
*balloon
;
196 struct W_Pixmap
*checkButtonImageOn
;
197 struct W_Pixmap
*checkButtonImageOff
;
199 struct W_Pixmap
*radioButtonImageOn
;
200 struct W_Pixmap
*radioButtonImageOff
;
202 struct W_Pixmap
*buttonArrow
;
203 struct W_Pixmap
*pushedButtonArrow
;
205 struct W_Pixmap
*scrollerDimple
;
207 struct W_Pixmap
*upArrow
;
208 struct W_Pixmap
*downArrow
;
209 struct W_Pixmap
*leftArrow
;
210 struct W_Pixmap
*rightArrow
;
212 struct W_Pixmap
*hiUpArrow
;
213 struct W_Pixmap
*hiDownArrow
;
214 struct W_Pixmap
*hiLeftArrow
;
215 struct W_Pixmap
*hiRightArrow
;
217 struct W_Pixmap
*pullDownIndicator
;
218 struct W_Pixmap
*popUpIndicator
;
220 struct W_Pixmap
*checkMark
;
222 struct W_Pixmap
*homeIcon
;
223 struct W_Pixmap
*altHomeIcon
;
225 struct W_Pixmap
*trashcanIcon
;
226 struct W_Pixmap
*altTrashcanIcon
;
228 struct W_Pixmap
*createDirIcon
;
229 struct W_Pixmap
*altCreateDirIcon
;
231 struct W_Pixmap
*disketteIcon
;
232 struct W_Pixmap
*altDisketteIcon
;
233 struct W_Pixmap
*unmountIcon
;
234 struct W_Pixmap
*altUnmountIcon
;
236 struct W_Pixmap
*magnifyIcon
;
237 /* struct W_Pixmap *altMagnifyIcon;*/
238 struct W_Pixmap
*wheelIcon
;
239 struct W_Pixmap
*grayIcon
;
240 struct W_Pixmap
*rgbIcon
;
241 struct W_Pixmap
*cmykIcon
;
242 struct W_Pixmap
*hsbIcon
;
243 struct W_Pixmap
*customPaletteIcon
;
244 struct W_Pixmap
*colorListIcon
;
246 struct W_Pixmap
*defaultObjectIcon
;
248 Cursor defaultCursor
;
252 Cursor invisibleCursor
;
254 Atom attribsAtom
; /* GNUstepWindowAttributes */
256 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
258 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
260 Atom clipboardAtom
; /* CLIPBOARD */
262 Atom xdndAwareAtom
; /* XdndAware */
263 Atom xdndSelectionAtom
;
266 Atom xdndPositionAtom
;
268 Atom xdndFinishedAtom
;
269 Atom xdndTypeListAtom
;
276 Atom xdndActionPrivate
;
278 Atom wmIconDragOffsetAtom
;
280 Atom wmStateAtom
; /* WM_STATE */
282 /* stuff for detecting double-clicks */
283 Time lastClickTime
; /* time of last mousedown event */
284 Window lastClickWindow
; /* window of the last mousedown */
286 struct W_View
*modalView
;
287 unsigned modalLoop
:1;
288 unsigned ignoreNextDoubleClick
:1;
293 typedef struct W_ViewDelegate
{
296 void (*didMove
)(struct W_ViewDelegate
*, WMView
*);
298 void (*didResize
)(struct W_ViewDelegate
*, WMView
*);
300 void (*willMove
)(struct W_ViewDelegate
*, WMView
*, int*, int*);
302 void (*willResize
)(struct W_ViewDelegate
*, WMView
*,
303 unsigned int*, unsigned int*);
308 typedef struct W_View
{
309 struct W_Screen
*screen
;
311 WMWidget
*self
; /* must point to the widget the
314 W_ViewDelegate
*delegate
;
322 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
323 struct W_View
*prevFocusChain
;
325 struct W_View
*nextResponder
; /* next to receive keyboard events */
327 struct W_View
*parent
; /* parent WMView */
329 struct W_View
*childrenList
; /* first in list of child windows */
331 struct W_View
*nextSister
; /* next on parent's children list */
333 WMBag
*eventHandlers
; /* event handlers for this window */
335 unsigned long attribFlags
;
336 XSetWindowAttributes attribs
;
338 void *hangedData
; /* data holder for user program */
344 Atom
*droppableTypes
;
345 struct W_DragSourceProcs
*dragSourceProcs
;
346 struct W_DragDestinationProcs
*dragDestinationProcs
;
351 unsigned int realized
:1;
352 unsigned int mapped
:1;
353 unsigned int parentDying
:1;
354 unsigned int dying
:1; /* the view is being destroyed */
355 unsigned int topLevel
:1; /* is a top level window */
356 unsigned int root
:1; /* is the root window */
357 unsigned int mapWhenRealized
:1;/* map the view when it's realized */
358 unsigned int alreadyDead
:1; /* view was freed */
360 unsigned int dontCompressMotion
:1; /* motion notify event compress */
361 unsigned int notifySizeChanged
:1;
362 unsigned int dontCompressExpose
:1; /* will compress all expose
365 unsigned int worksWhenModal
:1;
366 unsigned int pendingRelease1
:1;
367 unsigned int pendingRelease2
:1;
368 unsigned int pendingRelease3
:1;
369 unsigned int pendingRelease4
:1;
370 unsigned int pendingRelease5
:1;
371 unsigned int xdndHintSet
:1;
378 typedef struct W_EventHandler
{
379 unsigned long eventMask
;
389 typedef struct _WINGsConfiguration
{
391 char *boldSystemFont
;
395 unsigned doubleClickDelay
;
396 unsigned mouseWheelUp
;
397 unsigned mouseWheelDown
;
398 } _WINGsConfiguration
;
400 extern _WINGsConfiguration WINGsConfiguration
;
404 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
407 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
408 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
410 #define W_VIEW_REALIZED(view) (view)->flags.realized
411 #define W_VIEW_MAPPED(view) (view)->flags.mapped
413 #define W_VIEW_DISPLAY(view) (view)->screen->display
414 #define W_VIEW_SCREEN(view) (view)->screen
415 #define W_VIEW_DRAWABLE(view) (view)->window
417 #define W_VIEW_WIDTH(view) (view)->size.width
418 #define W_VIEW_HEIGHT(view) (view)->size.height
421 #define W_PIXEL(c) (c)->color.pixel
423 #define W_FONTID(f) (f)->font->fid
425 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
429 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
431 W_View
*W_CreateView(W_View
*parent
);
433 W_View
*W_CreateTopView(W_Screen
*screen
);
435 W_View
*W_CreateUnmanagedTopView(W_Screen
*screen
);
438 W_View
*W_CreateRootView(W_Screen
*screen
);
440 void W_DestroyView(W_View
*view
);
442 void W_RealizeView(W_View
*view
);
444 void W_ReparentView(W_View
*view
, W_View
*newParent
, int x
, int y
);
446 void W_RaiseView(W_View
*view
);
448 void W_LowerView(W_View
*view
);
451 void W_MapView(W_View
*view
);
453 void W_MapSubviews(W_View
*view
);
455 void W_UnmapSubviews(W_View
*view
);
457 W_View
*W_TopLevelOfView(W_View
*view
);
459 void W_UnmapView(W_View
*view
);
461 void W_MoveView(W_View
*view
, int x
, int y
);
463 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
465 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
467 void W_SetViewCursor(W_View
*view
, Cursor cursor
);
469 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
470 unsigned int height
, WMReliefType relief
);
472 void W_DrawReliefWithGC(W_Screen
*scr
, Drawable d
, int x
, int y
,
473 unsigned int width
, unsigned int height
,
475 GC black
, GC dark
, GC light
, GC white
);
477 void W_CleanUpEvents(W_View
*view
);
479 void W_CallDestroyHandlers(W_View
*view
);
481 void W_PaintTextAndImage(W_View
*view
, int wrap
, GC textGC
, W_Font
*font
,
482 WMReliefType relief
, char *text
,
483 WMAlignment alignment
, W_Pixmap
*image
,
484 WMImagePosition position
, GC backGC
, int ofs
);
486 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
487 int width
, WMAlignment alignment
, GC gc
,
488 int wrap
, char *text
, int length
);
490 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
493 int W_TextWidth(WMFont
*font
, char *text
, int length
);
496 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
498 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
500 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
502 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
504 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
506 void W_ReleaseView(WMView
*view
);
508 WMView
*W_RetainView(WMView
*view
);
510 void W_InitApplication(WMScreen
*scr
);
512 void W_InitNotificationCenter(void);
514 W_Class
W_RegisterUserWidget(void);
516 void W_RedisplayView(WMView
*view
);
518 Bool
W_ApplicationInitialized(void);
520 void W_HandleSelectionEvent(XEvent
*event
);
522 void W_HandleDNDClientMessage(WMView
*toplevel
, XClientMessageEvent
*event
);
524 void W_FlushASAPNotificationQueue();
526 void W_FlushIdleNotificationQueue();
528 struct W_Balloon
*W_CreateBalloon(WMScreen
*scr
);
530 void W_BalloonHandleEnterView(WMView
*view
);
532 void W_BalloonHandleLeaveView(WMView
*view
);
536 #endif /* __cplusplus */
538 #endif /* _WINGSP_H_ */