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_VIEW_SCREEN(view) (view)->screen
373 #define W_VIEW_DRAWABLE(view) (view)->window
375 #define W_VIEW_WIDTH(view) (view)->size.width
376 #define W_VIEW_HEIGHT(view) (view)->size.height
379 #define W_PIXEL(c) (c)->color.pixel
381 #define W_FONTID(f) (f)->font->fid
383 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
387 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
389 W_View
*W_CreateView(W_View
*parent
);
391 W_View
*W_CreateTopView(W_Screen
*screen
);
394 W_View
*W_CreateRootView(W_Screen
*screen
);
396 void W_DestroyView(W_View
*view
);
398 void W_RealizeView(W_View
*view
);
400 void W_ReparentView(W_View
*view
, W_View
*newParent
, int x
, int y
);
402 void W_MapView(W_View
*view
);
404 void W_MapSubviews(W_View
*view
);
406 void W_UnmapSubviews(W_View
*view
);
408 W_View
*W_TopLevelOfView(W_View
*view
);
410 void W_UnmapView(W_View
*view
);
412 void W_MoveView(W_View
*view
, int x
, int y
);
414 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
416 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
418 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
419 unsigned int height
, WMReliefType relief
);
422 void W_CleanUpEvents(W_View
*view
);
424 void W_CallDestroyHandlers(W_View
*view
);
426 void W_PaintTextAndImage(W_View
*view
, int wrap
, GC textGC
, W_Font
*font
,
427 WMReliefType relief
, char *text
,
428 WMAlignment alignment
, W_Pixmap
*image
,
429 WMImagePosition position
, GC backGC
, int ofs
);
431 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
432 int width
, WMAlignment alignment
, GC gc
,
433 int wrap
, char *text
, int length
);
435 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
438 int W_TextWidth(WMFont
*font
, char *text
, int length
);
441 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
443 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
445 Bool
W_CheckInternalMessage(W_Screen
*scr
, XClientMessageEvent
*cev
, int event
);
447 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
449 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
451 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
453 void W_ReleaseView(WMView
*view
);
455 WMView
*W_RetainView(WMView
*view
);
457 void W_InitApplication(WMScreen
*scr
);
459 void W_InitNotificationCenter(void);
461 W_Class
W_RegisterUserWidget(void);
463 void W_RedisplayView(WMView
*view
);
465 Bool
W_ApplicationInitialized(void);
467 char *W_GetTextSelection(WMScreen
*scr
, Atom selection
);
469 void W_HandleSelectionEvent(XEvent
*event
);
472 void W_FlushASAPNotificationQueue();
474 void W_FlushIdleNotificationQueue();
476 struct W_Balloon
*W_CreateBalloon(WMScreen
*scr
);
478 void W_BalloonHandleEnterView(WMView
*view
);
480 void W_BalloonHandleLeaveView(WMView
*view
);
484 #endif /* __cplusplus */
486 #endif /* _WINGSP_H_ */