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
;
180 struct W_Pixmap
*homeAltIcon
;
182 struct W_Pixmap
*magnifyIcon
;
183 struct W_Pixmap
*wheelIcon
;
184 struct W_Pixmap
*grayIcon
;
185 struct W_Pixmap
*rgbIcon
;
186 struct W_Pixmap
*cmykIcon
;
187 struct W_Pixmap
*hsbIcon
;
188 struct W_Pixmap
*customPaletteIcon
;
189 struct W_Pixmap
*colorListIcon
;
191 struct W_Pixmap
*magnifyAltIcon
;
192 struct W_Pixmap
*wheelAltIcon
;
193 struct W_Pixmap
*grayAltIcon
;
194 struct W_Pixmap
*rgbAltIcon
;
195 struct W_Pixmap
*cmykAltIcon
;
196 struct W_Pixmap
*hsbAltIcon
;
197 struct W_Pixmap
*customPaletteAltIcon
;
198 struct W_Pixmap
*colorListAltIcon
;
200 struct W_Pixmap
*defaultObjectIcon
;
202 Cursor defaultCursor
;
206 Atom internalMessage
; /* for ClientMessage */
208 Atom attribsAtom
; /* GNUstepWindowAttributes */
210 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
212 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
214 Atom clipboardAtom
; /* CLIPBOARD */
217 /* stuff for detecting double-clicks */
218 Time lastClickTime
; /* time of last mousedown event */
219 Window lastClickWindow
; /* window of the last mousedown */
221 struct W_View
*modalView
;
223 unsigned ignoreNextDoubleClick
:1;
228 typedef struct W_View
{
229 struct W_Screen
*screen
;
231 WMWidget
*self
; /* must point to the widget the
240 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
241 struct W_View
*prevFocusChain
;
243 struct W_View
*parent
; /* parent WMView */
245 struct W_View
*childrenList
; /* first in list of child windows */
247 struct W_View
*nextSister
; /* next on parent's children list */
249 struct W_EventHandler
*handlerList
;/* list of event handlers for this window */
251 unsigned long attribFlags
;
252 XSetWindowAttributes attribs
;
254 void *hangedData
; /* data holder for user program */
256 struct W_DragSourceProcs
*dragSourceProcs
;
257 struct W_DragDestinationProcs
*dragDestinationProcs
;
262 unsigned int realized
:1;
263 unsigned int mapped
:1;
264 unsigned int parentDying
:1;
265 unsigned int dying
:1; /* the view is being destroyed */
266 unsigned int topLevel
:1; /* is a top level window */
267 unsigned int root
:1; /* is the root window */
268 unsigned int mapWhenRealized
:1;/* map the view when it's realized */
269 unsigned int alreadyDead
:1; /* view was freed */
271 unsigned int dontCompressMotion
:1; /* motion notify event compress */
272 unsigned int notifySizeChanged
:1;
273 unsigned int dontCompressExpose
:1; /* will compress all expose
276 unsigned int worksWhenModal
:1;
277 unsigned int pendingRelease1
:1;
278 unsigned int pendingRelease2
:1;
279 unsigned int pendingRelease3
:1;
280 unsigned int pendingRelease4
:1;
281 unsigned int pendingRelease5
:1;
288 typedef struct W_EventHandler
{
289 unsigned long eventMask
;
295 struct W_EventHandler
*nextHandler
;
300 typedef struct W_ViewProcedureTable
{
301 void (*setBackgroundColor
)(WMWidget
*, WMColor
*color
);
302 void (*resize
)(WMWidget
*, unsigned int, unsigned int);
303 void (*move
)(WMWidget
*, int, int);
304 } W_ViewProcedureTable
;
308 typedef struct _WINGsConfiguration
{
310 char *boldSystemFont
;
311 unsigned doubleClickDelay
;
312 } _WINGsConfiguration
;
314 _WINGsConfiguration WINGsConfiguration
;
318 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
321 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
322 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
324 #define W_VIEW_REALIZED(view) (view)->flags.realized
325 #define W_VIEW_MAPPED(view) (view)->flags.mapped
327 #define W_PIXEL(c) (c)->color.pixel
328 #define W_GC(c) (c)->gc
330 #define W_FONTID(f) (f)->font->fid
332 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
336 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
338 W_View
*W_CreateView(W_View
*parent
);
340 W_View
*W_CreateTopView(W_Screen
*screen
);
343 W_View
*W_CreateRootView(W_Screen
*screen
);
345 void W_DestroyView(W_View
*view
);
347 void W_RealizeView(W_View
*view
);
349 void W_ReparentView(W_View
*view
, W_View
*newParent
);
351 void W_MapView(W_View
*view
);
353 void W_MapSubviews(W_View
*view
);
355 void W_UnmapSubviews(W_View
*view
);
357 W_View
*W_TopLevelOfView(W_View
*view
);
359 void W_UnmapView(W_View
*view
);
361 void W_MoveView(W_View
*view
, int x
, int y
);
363 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
365 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
367 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
368 unsigned int height
, WMReliefType relief
);
371 void W_CleanUpEvents(W_View
*view
);
373 void W_CallDestroyHandlers(W_View
*view
);
375 void W_PaintTextAndImage(W_View
*view
, int wrap
, GC textGC
, W_Font
*font
,
376 WMReliefType relief
, char *text
,
377 WMAlignment alignment
, W_Pixmap
*image
,
378 WMImagePosition position
, GC backGC
, int ofs
);
380 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
381 int width
, WMAlignment alignment
, GC gc
,
382 int wrap
, char *text
, int length
);
384 int W_GetTextHeight(WMFont
*font
, char *text
, int width
, int wrap
);
387 int W_TextWidth(WMFont
*font
, char *text
, int length
);
390 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
392 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
394 Bool
W_CheckInternalMessage(W_Screen
*scr
, XClientMessageEvent
*cev
, int event
);
396 void W_SetFocusOfToplevel(W_View
*toplevel
, W_View
*view
);
398 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
400 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
402 void W_ReleaseView(WMView
*view
);
404 WMView
*W_RetainView(WMView
*view
);
406 void W_InitApplication(WMScreen
*scr
);
408 void W_InitNotificationCenter(void);
410 W_Class
W_RegisterUserWidget(W_ViewProcedureTable
*procTable
);
412 void W_RedisplayView(WMView
*view
);
414 Bool
W_ApplicationInitialized(void);
416 char *W_GetTextSelection(WMScreen
*scr
, Atom selection
);
418 void W_HandleSelectionEvent(XEvent
*event
);