22 #ifndef KJB_CPP_GUI_WINDOW_H
23 #define KJB_CPP_GUI_WINDOW_H
25 #ifdef KJB_HAVE_OPENGL
30 #include <boost/shared_ptr.hpp>
31 #include <boost/function.hpp>
43 class Window :
public Interactive_overlay
46 typedef Interactive_overlay Base;
53 void operator()(
void const*)
const
57 class Close_button :
public Abstract_button
60 Close_button(
int x,
int y,
int width,
int height,
const boost::function0<void>& callback);
62 virtual void render_down()
const;
63 virtual void render_up()
const
69 void render_circle_()
const;
70 void render_plus_()
const;
80 virtual void render()
const;
86 void attach(Interactive_overlay* overlay);
91 void attach(boost::shared_ptr<Interactive_overlay> overlay);
96 void attach(Overlay* overlay);
101 void attach(boost::shared_ptr<Overlay> overlay);
106 void set_close_callback(
const boost::function0<void>& callback);
115 void set_clicked_callback(
const boost::function0<void>& callback);
121 bool mouse_event(
int button,
int state,
int x,
int y);
123 bool mouse_double_event(
int button,
int state,
int x,
int y);
125 bool motion_event(
int x,
int y);
127 bool passive_motion_event(
int x,
int y);
129 bool keyboard_event(
unsigned int key,
int x,
int y);
131 bool special_event(
int key,
int x,
int y);
141 virtual void set_size(
int width,
int height);
145 virtual void set_position(
int x,
int y);
159 void hide_titlebar();
161 void show_titlebar();
165 bool mouse_dispatch_(
int button,
int state,
int x,
int y);
167 bool cursor_on_left_border(
int cursor_x,
int cursor_y)
const;
169 bool cursor_on_right_border(
int cursor_x,
int cursor_y)
const;
171 bool cursor_on_bottom_border(
int cursor_x,
int cursor_y)
const;
173 bool cursor_on_top_border(
int cursor_x,
int cursor_y)
const;
175 bool has_focus()
const;
184 bool title_bar_click_(
int button,
int state,
int x,
int y);
192 bool resize_click_(
int button,
int state,
int x,
int y);
201 void drag_move_(
int cursor_x,
int cursor_y);
208 void drag_resize_(
int cursor_x,
int cursor_y);
214 inline bool point_inside_window_(
int pt_x,
int pt_y)
216 if( pt_x <
x() )
return false;
217 if( pt_x >=
x() + width() )
return false;
218 if( pt_y < y() )
return false;
219 if( pt_y >= y() +
height() )
return false;
227 void update_overlay_geometry_();
229 void update_close_button_geometry_();
232 void render_background_()
const;
234 void render_border_()
const;
236 void render_title_bar_()
const;
240 enum Click_state {click_none, click_resize, click_move};
241 enum Resize_state {resize_none, resize_left, resize_right, resize_bottom, resize_top};
248 boost::function0<void> clicked_callback_;
250 Close_button close_button_;
251 boost::function0<void> close_callback_;
253 boost::shared_ptr<Overlay> overlay_;
254 boost::shared_ptr<Event_listener> listener_;
256 Click_state click_state_;
257 Resize_state x_resize_state_;
258 Resize_state y_resize_state_;
262 bool special_cursor_;
265 static const int TITLE_BAR_HEIGHT;
266 static const int BORDER_WIDTH;
267 static const int BORDER_SLOP;
268 static const int MIN_WINDOW_HEIGHT;
269 static const int MIN_WINDOW_WIDTH;
270 static const int PADDING;
271 static const int CLOSE_BUTTON_HEIGHT;
272 static const int CLOSE_BUTTON_WIDTH;
273 static const int CLOSE_BUTTON_X_OFFSET;
274 static const int CLOSE_BUTTON_Y_OFFSET;
height
Definition: APPgetLargeConnectedEdges.m:33
x
Definition: APPgetLargeConnectedEdges.m:100
void render(const Cuboid &c)
Definition: psi_weighted_box.cpp:56