Update for 0.51.0
[wmaker-crm.git] / src / framewin.h
blob7c3dcee4bf5eecdbf44509ecfb003908880f4dc3
1 /*
2 * Window Maker window manager
3 *
4 * Copyright (c) 1997, 1998 Alfredo K. Kojima
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program 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
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 * USA.
22 #ifndef WMFRAMEWINDOW_H_
23 #define WMFRAMEWINDOW_H_
26 #define BORDER_TOP 1
27 #define BORDER_BOTTOM 2
28 #define BORDER_LEFT 4
29 #define BORDER_RIGHT 8
30 #define BORDER_ALL (1|2|4|8)
33 #define WFF_TITLEBAR (1<<0)
34 #define WFF_LEFT_BUTTON (1<<1)
35 #define WFF_RIGHT_BUTTON (1<<2)
36 #define WFF_RESIZEBAR (1<<3)
37 #define WFF_BORDER (1<<4)
38 #define WFF_SINGLE_STATE (1<<5)
40 typedef struct WFrameWindow {
41 WScreen *screen_ptr; /* pointer to the screen structure */
43 WCoreWindow *core;
45 WCoreWindow *titlebar; /* the titlebar */
46 WCoreWindow *left_button; /* miniaturize button */
47 WCoreWindow *right_button; /* close button */
49 short workspace; /* workspace that the window occupies */
51 short top_width;
52 short bottom_width;
54 short resizebar_corner_width;
56 WCoreWindow *resizebar; /* bottom resizebar */
58 Pixmap title_back[3]; /* focused, unfocused, pfocused */
59 Pixmap lbutton_back[3];
60 Pixmap rbutton_back[3];
62 WPixmap *lbutton_image;
63 WPixmap *rbutton_image;
65 union WTexture **title_texture;
66 union WTexture **resizebar_texture;
67 unsigned long *title_pixel;
68 GC *title_gc;
69 WFont **font;
71 char *title; /* window name (title) */
73 /* thing that uses this frame. passed as data to callbacks */
74 void *child;
76 /* callbacks */
77 void (*on_click_left)(WCoreWindow *sender, void *data, XEvent *event);
79 void (*on_click_right)(WCoreWindow *sender, void *data, XEvent *event);
80 void (*on_dblclick_right)(WCoreWindow *sender, void *data, XEvent *event);
82 void (*on_mousedown_titlebar)(WCoreWindow *sender, void *data, XEvent *event);
83 void (*on_dblclick_titlebar)(WCoreWindow *sender, void *data, XEvent *event);
85 void (*on_mousedown_resizebar)(WCoreWindow *sender, void *data, XEvent *event);
87 struct {
88 unsigned int state:2; /* 3 possible states */
89 unsigned int justification:2;
90 unsigned int titlebar:1;
91 unsigned int resizebar:1;
92 unsigned int left_button:1;
93 unsigned int right_button:1;
94 unsigned int need_texture_remake:1;
95 unsigned int single_texture:1;
97 unsigned int hide_left_button:1;
98 unsigned int hide_right_button:1;
100 unsigned int need_texture_change:1;
102 unsigned int lbutton_dont_fit:1;
103 unsigned int rbutton_dont_fit:1;
105 unsigned int repaint_only_titlebar:1;
106 unsigned int repaint_only_resizebar:1;
108 unsigned int is_client_window_frame:1;
110 unsigned int incomplete_title:1;
112 #ifdef OLWM_HINTS
113 unsigned int right_button_pushed_in:1;
114 #endif
115 } flags;
116 } WFrameWindow;
119 WFrameWindow*
120 wFrameWindowCreate(WScreen *scr, int wlevel, int x, int y,
121 int width, int height, int flags,
122 union WTexture **title_texture,
123 union WTexture **resize_texture,
124 unsigned long *color, GC *gc, WFont **font);
126 void wFrameWindowUpdateBorders(WFrameWindow *fwin, int flags);
128 void wFrameWindowDestroy(WFrameWindow *fwin);
130 void wFrameWindowChangeState(WFrameWindow *fwin, int state);
132 void wFrameWindowPaint(WFrameWindow *fwin);
134 void wFrameWindowConfigure(WFrameWindow *fwin, int x, int y, int width, int height);
136 void wFrameWindowResize(WFrameWindow *fwin, int width, int height);
138 void wFrameWindowShowButton(WFrameWindow *fwin, int flags);
140 void wFrameWindowHideButton(WFrameWindow *fwin, int flags);
142 int wFrameWindowChangeTitle(WFrameWindow *fwin, char *new_title);
144 #ifdef OLWM_HINTS
145 void wFrameWindowUpdatePushButton(WFrameWindow *fwin, Bool pushed);
146 #endif
148 #endif