KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gui_overlay.h
Go to the documentation of this file.
1 /* $Id: gui_overlay.h 18278 2014-11-25 01:42:10Z ksimek $ */
2 /* {{{=========================================================================== *
3  |
4  | Copyright (c) 1994-2011 by Kobus Barnard (author)
5  |
6  | Personal and educational use of this code is granted, provided that this
7  | header is kept intact, and that the authorship is not misrepresented, that
8  | its use is acknowledged in publications, and relevant papers are cited.
9  |
10  | For other use contact the author (kobus AT cs DOT arizona DOT edu).
11  |
12  | Please note that the code in this file has not necessarily been adequately
13  | tested. Naturally, there is no guarantee of performance, support, or fitness
14  | for any particular task. Nonetheless, I am interested in hearing about
15  | problems that you encounter.
16  |
17  | Author: Kyle Simek
18  * =========================================================================== }}}*/
19 
20 // vim: tabstop=4 shiftwidth=4 foldmethod=marker
21 
22 #ifndef KJB_CPP_GUI_OVERLAY_H
23 #define KJB_CPP_GUI_OVERLAY_H
24 
25 #ifdef KJB_HAVE_OPENGL
26 
27 #include <boost/function.hpp>
28 #include <gr_cpp/gr_renderable.h>
30 
31 namespace kjb
32 {
33 namespace gui
34 {
45 class Overlay : public kjb::Renderable
46 {
47 public:
48  Overlay();
49  Overlay(int x, int y, int width, int height);
50 
51  virtual void render() const = 0;
52 
53  void set_width(int width);
54 
55  void set_height(int height);
56 
57  virtual void set_size(int width, int height);
58 
59  virtual void set_position(int x, int y);
60 
61  virtual int width() const { return width_; }
62  virtual int height() const { return height_; }
63 
64  virtual int x() const { return x_pos_; }
65  virtual int y() const { return y_pos_; }
66 private:
67  int x_pos_, y_pos_;
68  int width_, height_;
69 };
70 
71 class Interactive_overlay : public Overlay, public Event_listener
72 {
73 public:
74  Interactive_overlay();
75 
76  Interactive_overlay(int x, int y, int width, int height);
77 };
78 
90 class Overlay_callback_wrapper : public Overlay
91 {
92 public:
93  Overlay_callback_wrapper(const boost::function0<void>& callback);
94 
95  Overlay_callback_wrapper(int x, int y, int width, int height, const boost::function0<void>& callback);
96 
97  virtual void render() const;
98 
99 private:
100  boost::function0<void> cb_;
101  bool enable_resizing_;
102  float orig_width_;
103  float orig_height_;
104 };
105 
106 } // namespace gui
107 } //namespace kjb
108 
109 #endif /* KJB_HAVE_OPENGL */
110 
111 #endif
Abstract class to render this object with GL.
Definition: gr_renderable.h:78
height
Definition: APPgetLargeConnectedEdges.m:33
Abstract class to render this object with GL.
x
Definition: APPgetLargeConnectedEdges.m:100
Definition: gui_event_listener.h:33
void render(const Cuboid &c)
Definition: psi_weighted_box.cpp:56