9 #if WINGS_H_VERSION < 980930
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
*homeIcon
;
179 struct W_Pixmap
*defaultObjectIcon
;
181 Cursor defaultCursor
;
185 Atom internalMessage
; /* for ClientMessage */
187 Atom attribsAtom
; /* GNUstepWindowAttributes */
189 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
191 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
193 Atom clipboardAtom
; /* CLIPBOARD */
196 /* stuff for detecting double-clicks */
197 Time lastClickTime
; /* time of last mousedown event */
198 Window lastClickWindow
; /* window of the last mousedown */
200 struct W_View
*modalView
;
202 unsigned ignoreNextDoubleClick
:1;
207 typedef struct W_View
{
208 struct W_Screen
*screen
;
210 WMWidget
*self
; /* must point to the widget the
219 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
220 struct W_View
*prevFocusChain
;
222 struct W_View
*parent
; /* parent WMView */
224 struct W_View
*childrenList
; /* first in list of child windows */
226 struct W_View
*nextSister
; /* next on parent's children list */
228 struct W_EventHandler
*handlerList
;/* list of event handlers for this window */
230 unsigned long attribFlags
;
231 XSetWindowAttributes attribs
;
233 void *hangedData
; /* data holder for user program */
235 struct W_DragSourceProcs
*dragSourceProcs
;
236 struct W_DragDestinationProcs
*dragDestinationProcs
;
241 unsigned int realized
:1;
242 unsigned int mapped
:1;
243 unsigned int parentDying
:1;
244 unsigned int dying
:1; /* the view is being destroyed */
245 unsigned int topLevel
:1; /* is a top level window */
246 unsigned int root
:1; /* is the root window */
247 unsigned int mapWhenRealized
:1;/* map the view when it's realized */
248 unsigned int alreadyDead
:1; /* view was freed */
250 unsigned int dontCompressMotion
:1; /* motion notify event compress */
251 unsigned int notifySizeChanged
:1;
252 unsigned int dontCompressExpose
:1; /* will compress all expose
255 unsigned int worksWhenModal
:1;
256 unsigned int pendingRelease1
:1;
257 unsigned int pendingRelease2
:1;
258 unsigned int pendingRelease3
:1;
259 unsigned int pendingRelease4
:1;
260 unsigned int pendingRelease5
:1;
267 typedef struct W_EventHandler
{
268 unsigned long eventMask
;
274 struct W_EventHandler
*nextHandler
;
279 typedef struct W_ViewProcedureTable
{
280 void (*setBackgroundColor
)(WMWidget
*, WMColor
*color
);
281 void (*resize
)(WMWidget
*, unsigned int, unsigned int);
282 void (*move
)(WMWidget
*, int, int);
283 } W_ViewProcedureTable
;
287 typedef struct _WINGsConfiguration
{
289 char *boldSystemFont
;
290 unsigned doubleClickDelay
;
291 } _WINGsConfiguration
;
293 _WINGsConfiguration WINGsConfiguration
;
297 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
300 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
301 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
303 #define W_VIEW_REALIZED(view) (view)->flags.realized
304 #define W_VIEW_MAPPED(view) (view)->flags.mapped
306 #define W_PIXEL(c) (c)->color.pixel
307 #define W_GC(c) (c)->gc
309 #define W_FONTID(f) (f)->font->fid
311 #define W_DRAWABLE(scr) (scr)->rootWin
314 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
316 W_View
*W_CreateView(W_View
*parent
);
318 W_View
*W_CreateTopView(W_Screen
*screen
);
321 W_View
*W_CreateRootView(W_Screen
*screen
);
323 void W_DestroyView(W_View
*view
);
325 void W_RealizeView(W_View
*view
);
327 void W_ReparentView(W_View
*view
, W_View
*newParent
);
329 void W_MapView(W_View
*view
);
331 void W_MapSubviews(W_View
*view
);
333 void W_UnmapSubviews(W_View
*view
);
335 W_View
*W_TopLevelOfView(W_View
*view
);
337 void W_UnmapView(W_View
*view
);
339 void W_MoveView(W_View
*view
, int x
, int y
);
341 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
343 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
345 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
346 unsigned int height
, WMReliefType relief
);
349 void W_CleanUpEvents(W_View
*view
);
351 void W_CallDestroyHandlers(W_View
*view
);
353 void W_PaintTextAndImage(W_View
*view
, int wrap
, GC textGC
, W_Font
*font
,
354 WMReliefType relief
, char *text
,
355 WMAlignment alignment
, W_Pixmap
*image
,
356 WMImagePosition position
, GC backGC
, int ofs
);
358 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
359 int width
, WMAlignment alignment
, GC gc
,
360 int wrap
, char *text
, int length
);
362 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
365 int W_TextWidth(WMFont
*font
, char *text
, int length
);
368 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
370 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
372 Bool
W_CheckInternalMessage(W_Screen
*scr
, XClientMessageEvent
*cev
, int event
);
374 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
376 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
378 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
380 void W_ReleaseView(WMView
*view
);
382 WMView
*W_RetainView(WMView
*view
);
384 void W_InitApplication(WMScreen
*scr
);
386 void W_InitNotificationCenter(void);
388 W_Class
W_RegisterUserWidget(W_ViewProcedureTable
*procTable
);
390 void W_RedisplayView(WMView
*view
);
392 Bool
W_ApplicationInitialized(void);
394 char *W_GetTextSelection(WMScreen
*scr
, Atom selection
);