11 #if WINGS_H_VERSION < 991003
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
35 /* internal messages */
36 #define WM_UPDATE_COLORWELL 130
39 #define WM_USER_MESSAGE 1024
42 #define SETUP_INTERNAL_MESSAGE(event, scrPtr) \
43 event.xclient.type=ClientMessage;\
44 event.xclient.display=scrPtr->display;\
45 event.xclient.send_event=False;\
46 event.xclient.serial=0;\
47 event.xclient.format=32;\
48 event.xclient.message_type=scrPtr->internalMessage;
51 typedef struct W_Application
{
52 char *applicationName
;
59 typedef struct W_Font
{
60 struct W_Screen
*screen
;
70 unsigned int notFontSet
:1;
74 typedef struct W_Pixmap
{
75 struct W_Screen
*screen
;
79 unsigned short height
;
85 typedef struct W_Color
{
86 struct W_Screen
*screen
;
97 typedef struct W_FocusInfo
{
98 struct W_View
*toplevel
;
99 struct W_View
*focused
; /* view that has the focus in this toplevel */
100 struct W_FocusInfo
*next
;
104 typedef struct W_Screen
{
117 struct W_View
*rootView
;
121 /* application related */
123 W_FocusInfo
*focusInfo
;
125 struct W_Pixmap
*applicationIcon
;
127 struct W_Window
*windowList
; /* list of windows in the app */
129 Window groupLeader
; /* the leader of the application */
130 /* also used for other things */
132 struct W_SelectionHandlers
*selectionHandlerList
;
135 unsigned int hasAppIcon
:1;
136 unsigned int simpleApplication
:1;
139 WMOpenPanel
*sharedOpenPanel
;
140 WMSavePanel
*sharedSavePanel
;
142 struct W_FontPanel
*sharedFontPanel
;
144 struct W_ColorPanel
*sharedColorPanel
;
159 GC monoGC
; /* GC for 1bpp visuals */
163 GC ixorGC
; /* IncludeInferiors XOR */
171 WMHashTable
*fontCache
;
175 struct W_Balloon
*balloon
;
178 struct W_Pixmap
*checkButtonImageOn
;
179 struct W_Pixmap
*checkButtonImageOff
;
181 struct W_Pixmap
*radioButtonImageOn
;
182 struct W_Pixmap
*radioButtonImageOff
;
184 struct W_Pixmap
*buttonArrow
;
185 struct W_Pixmap
*pushedButtonArrow
;
187 struct W_Pixmap
*scrollerDimple
;
189 struct W_Pixmap
*upArrow
;
190 struct W_Pixmap
*downArrow
;
191 struct W_Pixmap
*leftArrow
;
192 struct W_Pixmap
*rightArrow
;
194 struct W_Pixmap
*hiUpArrow
;
195 struct W_Pixmap
*hiDownArrow
;
196 struct W_Pixmap
*hiLeftArrow
;
197 struct W_Pixmap
*hiRightArrow
;
199 struct W_Pixmap
*pullDownIndicator
;
200 struct W_Pixmap
*popUpIndicator
;
202 struct W_Pixmap
*checkMark
;
204 struct W_Pixmap
*homeIcon
;
205 struct W_Pixmap
*altHomeIcon
;
207 struct W_Pixmap
*trashcanIcon
;
208 struct W_Pixmap
*altTrashcanIcon
;
210 struct W_Pixmap
*createDirIcon
;
211 struct W_Pixmap
*altCreateDirIcon
;
213 struct W_Pixmap
*disketteIcon
;
214 struct W_Pixmap
*altDisketteIcon
;
215 struct W_Pixmap
*unmountIcon
;
216 struct W_Pixmap
*altUnmountIcon
;
218 struct W_Pixmap
*magnifyIcon
;
219 /* struct W_Pixmap *altMagnifyIcon;*/
220 struct W_Pixmap
*wheelIcon
;
221 struct W_Pixmap
*grayIcon
;
222 struct W_Pixmap
*rgbIcon
;
223 struct W_Pixmap
*cmykIcon
;
224 struct W_Pixmap
*hsbIcon
;
225 struct W_Pixmap
*customPaletteIcon
;
226 struct W_Pixmap
*colorListIcon
;
228 struct W_Pixmap
*defaultObjectIcon
;
230 Cursor defaultCursor
;
234 Cursor invisibleCursor
;
236 Atom internalMessage
; /* for ClientMessage */
238 Atom attribsAtom
; /* GNUstepWindowAttributes */
240 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
242 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
244 Atom clipboardAtom
; /* CLIPBOARD */
247 /* stuff for detecting double-clicks */
248 Time lastClickTime
; /* time of last mousedown event */
249 Window lastClickWindow
; /* window of the last mousedown */
251 struct W_View
*modalView
;
253 unsigned ignoreNextDoubleClick
:1;
258 typedef struct W_ViewDelegate
{
261 void (*didMove
)(struct W_ViewDelegate
*, WMView
*);
263 void (*didResize
)(struct W_ViewDelegate
*, WMView
*);
265 void (*willMove
)(struct W_ViewDelegate
*, WMView
*, int*, int*);
267 void (*willResize
)(struct W_ViewDelegate
*, WMView
*,
268 unsigned int*, unsigned int*);
273 typedef struct W_View
{
274 struct W_Screen
*screen
;
276 WMWidget
*self
; /* must point to the widget the
279 W_ViewDelegate
*delegate
;
287 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
288 struct W_View
*prevFocusChain
;
290 struct W_View
*parent
; /* parent WMView */
292 struct W_View
*childrenList
; /* first in list of child windows */
294 struct W_View
*nextSister
; /* next on parent's children list */
296 struct W_EventHandler
*handlerList
;/* list of event handlers for this window */
298 unsigned long attribFlags
;
299 XSetWindowAttributes attribs
;
301 void *hangedData
; /* data holder for user program */
306 struct W_DragSourceProcs
*dragSourceProcs
;
307 struct W_DragDestinationProcs
*dragDestinationProcs
;
312 unsigned int realized
:1;
313 unsigned int mapped
:1;
314 unsigned int parentDying
:1;
315 unsigned int dying
:1; /* the view is being destroyed */
316 unsigned int topLevel
:1; /* is a top level window */
317 unsigned int root
:1; /* is the root window */
318 unsigned int mapWhenRealized
:1;/* map the view when it's realized */
319 unsigned int alreadyDead
:1; /* view was freed */
321 unsigned int dontCompressMotion
:1; /* motion notify event compress */
322 unsigned int notifySizeChanged
:1;
323 unsigned int dontCompressExpose
:1; /* will compress all expose
326 unsigned int worksWhenModal
:1;
327 unsigned int pendingRelease1
:1;
328 unsigned int pendingRelease2
:1;
329 unsigned int pendingRelease3
:1;
330 unsigned int pendingRelease4
:1;
331 unsigned int pendingRelease5
:1;
338 typedef struct W_EventHandler
{
339 unsigned long eventMask
;
345 struct W_EventHandler
*nextHandler
;
351 typedef struct _WINGsConfiguration
{
353 char *boldSystemFont
;
356 unsigned doubleClickDelay
;
357 } _WINGsConfiguration
;
359 extern _WINGsConfiguration WINGsConfiguration
;
363 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
366 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
367 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
369 #define W_VIEW_REALIZED(view) (view)->flags.realized
370 #define W_VIEW_MAPPED(view) (view)->flags.mapped
372 #define W_PIXEL(c) (c)->color.pixel
374 #define W_FONTID(f) (f)->font->fid
376 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
380 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
382 W_View
*W_CreateView(W_View
*parent
);
384 W_View
*W_CreateTopView(W_Screen
*screen
);
387 W_View
*W_CreateRootView(W_Screen
*screen
);
389 void W_DestroyView(W_View
*view
);
391 void W_RealizeView(W_View
*view
);
393 void W_ReparentView(W_View
*view
, W_View
*newParent
, int x
, int y
);
395 void W_MapView(W_View
*view
);
397 void W_MapSubviews(W_View
*view
);
399 void W_UnmapSubviews(W_View
*view
);
401 W_View
*W_TopLevelOfView(W_View
*view
);
403 void W_UnmapView(W_View
*view
);
405 void W_MoveView(W_View
*view
, int x
, int y
);
407 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
409 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
411 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
412 unsigned int height
, WMReliefType relief
);
415 void W_CleanUpEvents(W_View
*view
);
417 void W_CallDestroyHandlers(W_View
*view
);
419 void W_PaintTextAndImage(W_View
*view
, int wrap
, GC textGC
, W_Font
*font
,
420 WMReliefType relief
, char *text
,
421 WMAlignment alignment
, W_Pixmap
*image
,
422 WMImagePosition position
, GC backGC
, int ofs
);
424 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
425 int width
, WMAlignment alignment
, GC gc
,
426 int wrap
, char *text
, int length
);
428 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
431 int W_TextWidth(WMFont
*font
, char *text
, int length
);
434 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
436 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
438 Bool
W_CheckInternalMessage(W_Screen
*scr
, XClientMessageEvent
*cev
, int event
);
440 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
442 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
444 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
446 void W_ReleaseView(WMView
*view
);
448 WMView
*W_RetainView(WMView
*view
);
450 void W_InitApplication(WMScreen
*scr
);
452 void W_InitNotificationCenter(void);
454 W_Class
W_RegisterUserWidget(void);
456 void W_RedisplayView(WMView
*view
);
458 Bool
W_ApplicationInitialized(void);
460 char *W_GetTextSelection(WMScreen
*scr
, Atom selection
);
462 void W_HandleSelectionEvent(XEvent
*event
);
465 void W_FlushASAPNotificationQueue();
467 void W_FlushIdleNotificationQueue();
469 struct W_Balloon
*W_CreateBalloon(WMScreen
*scr
);
471 void W_BalloonHandleEnterView(WMView
*view
);
473 void W_BalloonHandleLeaveView(WMView
*view
);
477 #endif /* __cplusplus */
479 #endif /* _WINGSP_H_ */