Fixed mem leak in wrlib.
[wmaker-crm.git] / wmlib / WMaker.h
blob1c2a8b269fb25f2e1d15afd681ca169fb476b3fd
1 /*
2 * WindowMaker interface definitions
3 *
4 * Copyright (C) 1997 Alfredo K. Kojima
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef _WMLIB_H_
22 #define _WMLIB_H_
24 /* the definitions in this file can change at any time. WINGs has more
25 * stable definitions */
27 #include <X11/Xlib.h>
28 #include <X11/Xmd.h>
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
34 typedef struct {
35 CARD32 flags;
36 CARD32 window_style;
37 CARD32 window_level;
38 CARD32 reserved;
39 Pixmap miniaturize_pixmap; /* pixmap for miniaturize button */
40 Pixmap close_pixmap; /* pixmap for close button */
41 Pixmap miniaturize_mask; /* miniaturize pixmap mask */
42 Pixmap close_mask; /* close pixmap mask */
43 CARD32 extra_flags;
44 } GNUstepWMAttributes;
46 #define GSWindowStyleAttr (1<<0)
47 #define GSWindowLevelAttr (1<<1)
48 #define GSMiniaturizePixmapAttr (1<<3)
49 #define GSClosePixmapAttr (1<<4)
50 #define GSMiniaturizeMaskAttr (1<<5)
51 #define GSCloseMaskAttr (1<<6)
52 #define GSExtraFlagsAttr (1<<7)
56 #define GSClientResizeFlag (1<<0)
57 #define GSFullKeyboardEventsFlag (1<<1)
58 #define GSMenuWindowFlag (1<<2)
59 #define GSIconWindowFlag (1<<3)
60 #define GSSkipWindowListFlag (1<<4)
61 #define GSNoApplicationIconFlag (1<<5)
62 #define GSDarkGrayTitlebarFlag (1<<8)
65 #define WMFHideOtherApplications 10
66 #define WMFHideApplication 12
69 #if !defined(_NSWindow_h_) && !defined(_GNUstep_H_GUITypes)
70 enum {
71 NSNormalWindowLevel = 0,
72 NSFloatingWindowLevel = 3,
73 NSDockWindowLevel = 5,
74 NSSubmenuWindowLevel = 10,
75 NSMainMenuWindowLevel = 20
78 enum {
79 NSBorderlessWindowMask = 0,
80 NSTitledWindowMask = 1,
81 NSClosableWindowMask = 2,
82 NSMiniaturizableWindowMask = 4,
83 NSResizableWindowMask = 8
85 #endif
87 typedef struct _wmAppContext WMAppContext;
89 typedef struct _wmMenu WMMenu;
91 typedef void (*WMMenuAction)(void *clientdata, int code, Time timestamp);
93 typedef void (*WMFreeFunction)(void *clientdata);
95 int WMProcessEvent(WMAppContext *app, XEvent *event);
98 WMAppContext *WMAppCreateWithMain(Display *display, int screen_number,
99 Window main_window);
101 WMAppContext *WMAppCreate(Display *display, int screen_number);
103 int WMAppAddWindow(WMAppContext *app, Window window);
105 int WMAppSetMainMenu(WMAppContext *app, WMMenu *menu);
108 int WMRealizeMenus(WMAppContext *app);
111 void WMSetWindowAttributes(Display *dpy, Window window,
112 GNUstepWMAttributes *attributes);
115 void WMHideApplication(WMAppContext *app);
116 void WMHideOthers(WMAppContext *app);
119 * WARNING: the menu related functions might be removed in the future.
121 WMMenu *WMMenuCreate(WMAppContext *app, char *title);
123 int WMMenuAddItem(WMMenu *menu, char *text, WMMenuAction action,
124 void *clientData, WMFreeFunction freedata, char *rtext);
126 int WMMenuInsertItem(WMMenu *menu, int index, char *text,
127 WMMenuAction *action, char *rtext);
129 int WMMenuRemoveItem(WMMenu *menu, int index);
131 int WMMenuAddSubmenu(WMMenu *menu, char *title, WMMenu *submenu);
133 void WMMenuSetEnabled(WMMenu *menu, int index, int enabled);
135 void WMMenuDestroy(WMMenu *menu, int submenus);
137 #ifdef __cplusplus
139 #endif /* __cplusplus */
141 #endif