9 #if WINGS_H_VERSION < 981220
10 #error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
23 #define WC_UserWidget 128
27 #define SCROLLER_WIDTH 20
29 /* internal messages */
30 #define WM_UPDATE_COLORWELL 130
33 #define WM_USER_MESSAGE 1024
36 #define SETUP_INTERNAL_MESSAGE(event, scrPtr) \
37 event.xclient.type=ClientMessage;\
38 event.xclient.display=scrPtr->display;\
39 event.xclient.send_event=False;\
40 event.xclient.serial=0;\
41 event.xclient.format=32;\
42 event.xclient.message_type=scrPtr->internalMessage;
45 typedef struct W_Font
{
46 struct W_Screen
*screen
;
55 unsigned int notFontSet
:1;
59 typedef struct W_Pixmap
{
60 struct W_Screen
*screen
;
64 unsigned short height
;
70 typedef struct W_Color
{
71 struct W_Screen
*screen
;
82 typedef struct W_FocusInfo
{
83 struct W_View
*toplevel
;
84 struct W_View
*focused
; /* view that has the focus in this toplevel */
85 struct W_FocusInfo
*next
;
88 typedef struct W_Screen
{
101 struct W_View
*rootView
;
105 /* application related */
107 W_FocusInfo
*focusInfo
;
109 struct W_Pixmap
*applicationIcon
;
111 struct W_Window
*windowList
; /* list of windows in the app */
113 Window groupLeader
; /* the leader of the application */
114 /* also used for other things */
116 struct W_SelectionHandlers
*selectionHandlerList
;
119 unsigned int hasAppIcon
:1;
120 unsigned int simpleApplication
:1;
123 WMOpenPanel
*sharedOpenPanel
;
124 WMSavePanel
*sharedSavePanel
;
126 struct W_FontPanel
*sharedFontPanel
;
128 struct W_ColorPanel
*sharedColorPanel
;
141 GC monoGC
; /* GC for 1bpp visuals */
145 GC ixorGC
; /* IncludeInferiors XOR */
153 struct W_Pixmap
*checkButtonImageOn
;
154 struct W_Pixmap
*checkButtonImageOff
;
156 struct W_Pixmap
*radioButtonImageOn
;
157 struct W_Pixmap
*radioButtonImageOff
;
159 struct W_Pixmap
*buttonArrow
;
160 struct W_Pixmap
*pushedButtonArrow
;
162 struct W_Pixmap
*scrollerDimple
;
164 struct W_Pixmap
*upArrow
;
165 struct W_Pixmap
*downArrow
;
166 struct W_Pixmap
*leftArrow
;
167 struct W_Pixmap
*rightArrow
;
169 struct W_Pixmap
*hiUpArrow
;
170 struct W_Pixmap
*hiDownArrow
;
171 struct W_Pixmap
*hiLeftArrow
;
172 struct W_Pixmap
*hiRightArrow
;
174 struct W_Pixmap
*pullDownIndicator
;
175 struct W_Pixmap
*popUpIndicator
;
177 struct W_Pixmap
*checkMark
;
179 struct W_Pixmap
*homeIcon
;
181 struct W_Pixmap
*defaultObjectIcon
;
183 Cursor defaultCursor
;
187 Atom internalMessage
; /* for ClientMessage */
189 Atom attribsAtom
; /* GNUstepWindowAttributes */
191 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
193 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
195 Atom clipboardAtom
; /* CLIPBOARD */
198 /* stuff for detecting double-clicks */
199 Time lastClickTime
; /* time of last mousedown event */
200 Window lastClickWindow
; /* window of the last mousedown */
202 struct W_View
*modalView
;
204 unsigned ignoreNextDoubleClick
:1;
209 typedef struct W_View
{
210 struct W_Screen
*screen
;
212 WMWidget
*self
; /* must point to the widget the
221 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
222 struct W_View
*prevFocusChain
;
224 struct W_View
*parent
; /* parent WMView */
226 struct W_View
*childrenList
; /* first in list of child windows */
228 struct W_View
*nextSister
; /* next on parent's children list */
230 struct W_EventHandler
*handlerList
;/* list of event handlers for this window */
232 unsigned long attribFlags
;
233 XSetWindowAttributes attribs
;
235 void *hangedData
; /* data holder for user program */
237 struct W_DragSourceProcs
*dragSourceProcs
;
238 struct W_DragDestinationProcs
*dragDestinationProcs
;
243 unsigned int realized
:1;
244 unsigned int mapped
:1;
245 unsigned int parentDying
:1;
246 unsigned int dying
:1; /* the view is being destroyed */
247 unsigned int topLevel
:1; /* is a top level window */
248 unsigned int root
:1; /* is the root window */
249 unsigned int mapWhenRealized
:1;/* map the view when it's realized */
250 unsigned int alreadyDead
:1; /* view was freed */
252 unsigned int dontCompressMotion
:1; /* motion notify event compress */
253 unsigned int notifySizeChanged
:1;
254 unsigned int dontCompressExpose
:1; /* will compress all expose
257 unsigned int worksWhenModal
:1;
258 unsigned int pendingRelease1
:1;
259 unsigned int pendingRelease2
:1;
260 unsigned int pendingRelease3
:1;
261 unsigned int pendingRelease4
:1;
262 unsigned int pendingRelease5
:1;
269 typedef struct W_EventHandler
{
270 unsigned long eventMask
;
276 struct W_EventHandler
*nextHandler
;
281 typedef struct W_ViewProcedureTable
{
282 void (*setBackgroundColor
)(WMWidget
*, WMColor
*color
);
283 void (*resize
)(WMWidget
*, unsigned int, unsigned int);
284 void (*move
)(WMWidget
*, int, int);
285 } W_ViewProcedureTable
;
289 typedef struct _WINGsConfiguration
{
291 char *boldSystemFont
;
292 unsigned doubleClickDelay
;
293 } _WINGsConfiguration
;
295 _WINGsConfiguration WINGsConfiguration
;
299 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
302 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
303 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
305 #define W_VIEW_REALIZED(view) (view)->flags.realized
306 #define W_VIEW_MAPPED(view) (view)->flags.mapped
308 #define W_PIXEL(c) (c)->color.pixel
309 #define W_GC(c) (c)->gc
311 #define W_FONTID(f) (f)->font->fid
313 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
317 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
319 W_View
*W_CreateView(W_View
*parent
);
321 W_View
*W_CreateTopView(W_Screen
*screen
);
324 W_View
*W_CreateRootView(W_Screen
*screen
);
326 void W_DestroyView(W_View
*view
);
328 void W_RealizeView(W_View
*view
);
330 void W_ReparentView(W_View
*view
, W_View
*newParent
);
332 void W_MapView(W_View
*view
);
334 void W_MapSubviews(W_View
*view
);
336 void W_UnmapSubviews(W_View
*view
);
338 W_View
*W_TopLevelOfView(W_View
*view
);
340 void W_UnmapView(W_View
*view
);
342 void W_MoveView(W_View
*view
, int x
, int y
);
344 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
346 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
348 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
349 unsigned int height
, WMReliefType relief
);
352 void W_CleanUpEvents(W_View
*view
);
354 void W_CallDestroyHandlers(W_View
*view
);
356 void W_PaintTextAndImage(W_View
*view
, int wrap
, GC textGC
, W_Font
*font
,
357 WMReliefType relief
, char *text
,
358 WMAlignment alignment
, W_Pixmap
*image
,
359 WMImagePosition position
, GC backGC
, int ofs
);
361 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
362 int width
, WMAlignment alignment
, GC gc
,
363 int wrap
, char *text
, int length
);
365 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
368 int W_TextWidth(WMFont
*font
, char *text
, int length
);
371 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
373 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
375 Bool
W_CheckInternalMessage(W_Screen
*scr
, XClientMessageEvent
*cev
, int event
);
377 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
379 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
381 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
383 void W_ReleaseView(WMView
*view
);
385 WMView
*W_RetainView(WMView
*view
);
387 void W_InitApplication(WMScreen
*scr
);
389 void W_InitNotificationCenter(void);
391 W_Class
W_RegisterUserWidget(W_ViewProcedureTable
*procTable
);
393 void W_RedisplayView(WMView
*view
);
395 Bool
W_ApplicationInitialized(void);
397 char *W_GetTextSelection(WMScreen
*scr
, Atom selection
);