zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Widget.hxx
Go to the documentation of this file.
1 /* This file is part of the Zenipex Library (zenilib).
2  * Copyright (C) 2011 Mitchell Keith Bloch (bazald).
3  *
4  * zenilib is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * zenilib is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with zenilib. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef ZENI_WIDGET_HXX
19 #define ZENI_WIDGET_HXX
20 
21 // HXXed below
22 #include <Zeni/Font.h>
23 #include <Zeni/Material.h>
24 #include <Zeni/Projector.h>
25 #include <Zeni/Timer.h>
26 #include <Zeni/Video.h>
27 
28 #include <Zeni/Widget.h>
29 
30 // Not HXXed
31 #include <Zeni/Colors.h>
32 #include <Zeni/Fonts.h>
33 
34 #include <cassert>
35 #include <algorithm>
36 
37 namespace Zeni {
38 
40  : m_layer(0.0f),
41  m_busy(false),
42  m_editable(true),
43  m_renderer(0),
44  delete_m_renderer(false)
45  {
46  }
47 
48  const bool & Widget::is_busy() const {
49  return m_busy;
50  }
51 
52  const bool & Widget::is_editable() const {
53  return m_editable;
54  }
55 
56  const float & Widget::get_layer() const {
57  return m_layer;
58  }
59 
60  void Widget::set_busy(const bool &busy_) {
61  m_busy = busy_;
62  }
63 
64  void Widget::set_layer(const float &layer_) {
65  m_layer = layer_;
66  }
67 
68 #ifndef ANDROID
70  on_key(event.keysym, event.type == SDL_KEYDOWN);
71  }
72 
74  on_mouse_button(Point2i(event.x, event.y),
75  event.type == SDL_MOUSEBUTTONDOWN,
76  event.button);
77  }
78 
79  void Widget::on_event(const SDL_MouseButtonEvent &event, const Projector2D &projector) {
80  const Point2f projected = projector.unproject(Point2f(float(event.x), float(event.y)));
81  on_mouse_button(Point2i(int(projected.x), int(projected.y)),
82  event.type == SDL_MOUSEBUTTONDOWN,
83  event.button);
84  }
85 
87  on_mouse_motion(Point2i(event.x, event.y));
88  }
89 
90  void Widget::on_event(const SDL_MouseMotionEvent &event, const Projector2D &projector) {
91  const Point2f projected = projector.unproject(Point2f(float(event.x), float(event.y)));
92  on_mouse_motion(Point2i(int(projected.x), int(projected.y)));
93  }
94 
95 #if SDL_VERSION_ATLEAST(2,0,0)
97  Point2i pos;
98  SDL_GetMouseState(&pos.x, &pos.y);
99  on_mouse_wheel(pos, event.y);
100  }
101 
102  void Widget::on_event(const SDL_MouseWheelEvent &event, const Projector2D &projector) {
103  Point2i pos;
104  SDL_GetMouseState(&pos.x, &pos.y);
105  const Point2f projected = projector.unproject(Point2f(float(pos.x), float(pos.y)));
106  on_mouse_wheel(Point2i(int(projected.x), int(projected.y)), event.y);
107  }
108 #endif
109 #endif
110 
111  void Widget::render() const {
112  Video &vr = get_Video();
113 
114  vr.push_world_stack();
115  vr.translate_scene(Vector3f(0.0f, 0.0f, m_layer));
116 
117  render_impl();
118 
119  vr.pop_world_stack();
120  }
121 
123  return m_renderer;
124  }
125 
127  if(delete_m_renderer)
128  delete m_renderer;
129  m_renderer = renderer;
130  delete_m_renderer = true;
131  }
132 
133  void Widget::lend_Renderer(const Widget_Render_Function * const &renderer) {
134  give_Renderer(const_cast<Widget_Render_Function * const &>(renderer));
135  delete_m_renderer = false;
136  }
137 
138  void Widget::fax_Renderer(const Widget_Render_Function * const &renderer) {
139  give_Renderer(renderer->get_duplicate());
140  }
141 
142  Widget_Rectangle::Widget_Rectangle(const Point2f &upper_left_, const Point2f &lower_right_)
143  : m_upper_left(upper_left_),
144  m_lower_right(lower_right_)
145  {
146  }
147 
149  return m_upper_left;
150  }
151 
153  return Point2f(m_upper_left.x, m_lower_right.y);
154  }
155 
157  return m_lower_right;
158  }
159 
161  return Point2f(m_lower_right.x, m_upper_left.y);
162  }
163 
165  return m_lower_right.y - m_upper_left.y;
166  }
167 
169  return m_lower_right.x - m_upper_left.x;
170  }
171 
173  return Point2f(0.5f * (m_upper_left.x + m_lower_right.x),
174  0.5f * (m_upper_left.y + m_lower_right.y));
175  }
176 
177  bool Widget_Rectangle::is_inside(const Point2i &pos) const {
178  return m_upper_left.x < pos.x && pos.x < m_lower_right.x &&
179  m_upper_left.y < pos.y && pos.y < m_lower_right.y;
180  }
181 
182  template <typename T1, typename T2>
183  Widget_Renderer_Pair<T1, T2>::Widget_Renderer_Pair(const T1 * const &first_, const bool &delete_first_,
184  const T2 * const &second_, const bool &delete_second_)
185  : m_first(const_cast<T1 * const &>(first_)),
186  delete_m_first(delete_first_),
187  m_second(const_cast<T2 * const &>(second_)),
188  delete_m_second(delete_second_)
189  {
190  }
191 
192  template <typename T1, typename T2>
194  if(delete_m_first)
195  delete m_first;
196  if(delete_m_second)
197  delete m_second;
198  }
199 
200  template <typename T1, typename T2>
201  const T1 * const & Widget_Renderer_Pair<T1, T2>::first() const {
202  return m_first;
203  }
204 
205  template <typename T1, typename T2>
206  const T2 * const & Widget_Renderer_Pair<T1, T2>::second() const {
207  return m_second;
208  }
209 
210  template <typename T1, typename T2>
212  return m_first;
213  }
214 
215  template <typename T1, typename T2>
217  return m_second;
218  }
219 
220  template <typename T1, typename T2>
222  if(m_first)
223  m_first->render_to(rect);
224  if(m_second)
225  m_second->render_to(rect);
226  }
227 
228  template <typename T1, typename T2>
230  return new Widget_Renderer_Pair<T1, T2>(new T1(*m_first), true, new T2(*m_second), true);
231  }
232 
233  template <typename T1, typename T2>
234  Widget_Renderer_Pair<T1, T2> * make_Widget_Renderer_Pair(const T1 * const &first_, const bool &delete_first_,
235  const T2 * const &second_, const bool &delete_second_)
236  {
237  return new Widget_Renderer_Pair<T1, T2>(first_, delete_first_, second_, delete_second_);
238  }
239 
240  Widget_Renderer_Text::Widget_Renderer_Text(const String &font_name_, const String &text_, const Color &color_)
241  : font_name(font_name_),
242  text(text_),
243  color(color_)
244  {
245  }
246 
248  : color(color_)
249  {
250  }
251 
253  : texture(texture_),
254  tex_coord_ul(0.0f, 0.0f),
255  tex_coord_ll(0.0f, 1.0f),
256  tex_coord_lr(1.0f, 1.0f),
257  tex_coord_ur(1.0f, 0.0f)
258  {
259  }
260 
262  const Point2f &tex_coord_ul_,
263  const Point2f &tex_coord_ll_,
264  const Point2f &tex_coord_lr_,
265  const Point2f &tex_coord_ur_)
266  : texture(texture_),
267  tex_coord_ul(tex_coord_ul_),
268  tex_coord_ll(tex_coord_ll_),
269  tex_coord_lr(tex_coord_lr_),
270  tex_coord_ur(tex_coord_ur_)
271  {
272  }
273 
276  bg_normal(get_Colors()["default_button_bg_normal"]),
277  bg_clicked(get_Colors()["default_button_bg_clicked"]),
278  bg_hovered_strayed(get_Colors()["default_button_bg_hovered_strayed"]),
279  text_normal(get_Colors()["default_button_text_normal"]),
280  text_clicked(get_Colors()["default_button_text_clicked"]),
281  text_hovered_strayed(get_Colors()["default_button_text_hovered_strayed"])
282  {
283  }
284 
285  Widget_Renderer_Tricolor::Widget_Renderer_Tricolor(const Color &bg_normal_, const Color &bg_clicked_, const Color &bg_hovered_strayed_,
286  const Color &text_normal_, const Color &text_clicked_, const Color &text_hovered_strayed_)
288  bg_normal(bg_normal_),
289  bg_clicked(bg_clicked_),
290  bg_hovered_strayed(bg_hovered_strayed_),
291  text_normal(text_normal_),
292  text_clicked(text_clicked_),
293  text_hovered_strayed(text_hovered_strayed_)
294  {
295  }
296 
298  : border_color(get_Colors()["default_button_bg_normal"]),
299  check_color(get_Colors()["default_button_bg_normal"])
300  {
301  }
302 
303  Widget_Renderer_Check_Box::Widget_Renderer_Check_Box(const Color &border_color_, const Color &check_color_)
304  : border_color(border_color_),
305  check_color(check_color_)
306  {
307  }
308 
310  : line_color(get_Colors()["default_button_bg_normal"]),
311  slider_color(get_Colors()["default_button_bg_normal"])
312  {
313  }
314 
315  Widget_Renderer_Slider::Widget_Renderer_Slider(const Color &line_color_, const Color &slider_color_)
316  : line_color(line_color_),
317  slider_color(slider_color_)
318  {
319  }
320 
321  Widget_Button::Widget_Button(const Point2f &upper_left_, const Point2f &lower_right_)
322  : Widget_Rectangle(upper_left_, lower_right_),
323  m_state(NORMAL)
324  {
325  }
326 
328  return m_state;
329  }
330 
331  Text_Button::Text_Button(const Point2f &upper_left_, const Point2f &lower_right_,
332  const String &font_name_, const String &text_)
333  : Widget_Button(upper_left_, lower_right_),
334  Widget_Renderer_Text(font_name_, text_, Color())
335  {
337  }
338 
339  Check_Box::Check_Box(const Point2f &upper_left_, const Point2f &lower_right_,
340  const bool &checked_, const bool &toggleable_)
341  : Widget_Button(upper_left_, lower_right_),
342  m_checked(checked_),
343  m_toggling(false)
344  {
345  set_editable(toggleable_);
346 
348  }
349 
350  const bool & Check_Box::is_checked() const {return m_checked;}
351  void Check_Box::set_checked(const bool &checked_) {m_checked = checked_;}
352  const bool & Check_Box::is_toggling() const {return m_toggling;}
353 
354  Radio_Button::Radio_Button(Radio_Button_Set &radio_button_set_,
355  const Point2f &upper_left_, const Point2f &lower_right_,
356  const bool &checked_, const bool &toggleable_)
357  : Check_Box(upper_left_, lower_right_, checked_, toggleable_),
358  m_radio_button_set(&radio_button_set_)
359  {
360  radio_button_set_.lend_Radio_Button(*this);
361  }
362 
364  if(m_radio_button_set)
365  m_radio_button_set->unlend_Radio_Button(*this);
366  }
367 
369  for(std::set<Radio_Button *>::iterator it = m_radio_buttons.begin(); it != m_radio_buttons.end(); ++it)
370  (*it)->set_checked((*it) == &radio_button);
371  }
372 
374  for(std::set<Radio_Button *>::iterator it = m_radio_buttons.begin(); it != m_radio_buttons.end(); ++it)
375  (*it)->set_checked(false);
376  }
377 
378  void Radio_Button_Set::lend_Radio_Button(Radio_Button &radio_button) {
379  m_radio_buttons.insert(&radio_button);
380  }
381 
382  void Radio_Button_Set::unlend_Radio_Button(Radio_Button &radio_button) {
383  m_radio_buttons.erase(&radio_button);
384  radio_button.m_radio_button_set = 0;
385  }
386 
388  return Point2f(m_line_segment.get_end_point_a());
389  }
390 
392  return Point2f(m_line_segment.get_end_point_b());
393  }
394 
395  const float & Slider::get_slider_radius() const {
396  return m_slider_radius;
397  }
398 
399  const float & Slider::get_slider_position() const {
400  return m_slider_position;
401  }
402 
403  void Slider::set_end_points(const Point2f &end_point_a_, const Point2f &end_point_b_) {
404  m_line_segment = Collision::Line_Segment(Point3f(end_point_a_), Point3f(end_point_b_));
405  }
406 
407  void Slider::set_slider_radius(const float &radius_) {
408  m_slider_radius = radius_;
409  }
410 
411  void Slider::set_slider_position(const float &slider_position_) {
412  if(slider_position_ < 0.0f)
413  m_slider_position = 0.0f;
414  else if(slider_position_ > 1.0f)
415  m_slider_position = 1.0f;
416  else
417  m_slider_position = slider_position_;
418  }
419 
420  const bool & Slider::is_mouse_wheel_inverted() const {
421  return m_mouse_wheel_inverted;
422  }
423 
424  void Slider::invert_mouse_wheel(const bool &invert) {
425  m_mouse_wheel_inverted = invert;
426  }
427 
429  return m_mouse_wheel_continuous_rate;
430  }
431 
432  void Slider::set_mouse_wheel_continuous_rate(const float &mouse_wheel_continuous_rate) {
433  m_mouse_wheel_continuous_rate = mouse_wheel_continuous_rate;
434  }
435 
437  return m_line_segment;
438  }
439 
441  return m_range;
442  }
443 
444  void Slider_Int::set_range(const Range &range_) {
445  assert(range_.first <= range_.second);
446  m_range = range_;
447  }
448 
449  int Slider_Int::get_value() const {
450  return int(get_slider_position() * (m_range.second - m_range.first) + 0.5f) + m_range.first;
451  }
452 
453  void Slider_Int::set_value(const int &value) {
454  const int clamped = value < m_range.first ? m_range.first : value > m_range.second ? m_range.second : value;
455  set_slider_position(float(clamped - m_range.first) / (m_range.second - m_range.first));
456  }
457 
459  return m_button_renderer;
460  }
461 
463  if(delete_m_button_renderer)
464  delete m_button_renderer;
465  m_button_renderer = renderer;
466  delete_m_button_renderer = true;
467 
468  m_normal_button.lend_Renderer(m_button_renderer);
469  for(std::vector<Selector_Button *>::iterator it = m_selector_buttons.begin(); it != m_selector_buttons.end(); ++it)
470  (*it)->lend_Renderer(m_button_renderer);
471  }
472 
474  give_Text_Button_Renderer(const_cast<Widget_Render_Function * const &>(renderer));
475  delete_m_button_renderer = false;
476  }
477 
480  }
481 
483  return m_slider_renderer;
484  }
485 
487  if(delete_m_slider_renderer)
488  delete m_slider_renderer;
489  m_slider_renderer = renderer;
490  delete_m_slider_renderer = true;
491 
492  m_selector_slider.lend_Renderer(m_slider_renderer);
493  }
494 
496  give_Slider_Renderer(const_cast<Widget_Render_Function * const &>(renderer));
497  delete_m_button_renderer = false;
498  }
499 
501  give_Slider_Renderer(renderer->get_duplicate());
502  }
503 
505  return m_slider_bg_renderer;
506  }
507 
509  if(delete_m_slider_bg_renderer)
510  delete m_slider_bg_renderer;
511  m_slider_bg_renderer = renderer;
512  delete_m_slider_bg_renderer = true;
513  }
514 
516  give_Slider_BG_Renderer(const_cast<Widget_Render_Function * const &>(renderer));
517  delete_m_slider_bg_renderer = false;
518  }
519 
522  }
523 
524  const String & Selector::get_Font() const {
525  return m_font;
526  }
527 
528  void Selector::set_font(const String &font_) {
529  m_font = font_;
530 
531  m_normal_button.font_name = m_font;
532  for(std::vector<Selector_Button *>::iterator it = m_selector_buttons.begin(); it != m_selector_buttons.end(); ++it)
533  (*it)->font_name = m_font;
534  }
535 
536  const String & Text_Box::get_font_name() const {
537  return m_text.font_name;
538  }
539 
540  const Font & Text_Box::get_Font() const {
541  return get_Fonts()[m_text.font_name];
542  }
543 
544  const String & Text_Box::get_text() const {
545  return m_text.text;
546  }
547 
548  const Color & Text_Box::get_text_color() const {
549  return m_text.color;
550  }
551 
552  const JUSTIFY & Text_Box::get_justify() const {
553  return m_justify;
554  }
555 
556  size_t Text_Box::get_num_lines() const {
557  return size_t(m_lines.size());
558  }
559 
560  size_t Text_Box::get_max_lines() const {
561  return size_t(get_height() / get_Font().get_text_height());
562  }
563 
564  void Text_Box::set_font_name(const String &font_name_) {
565  m_text.font_name = font_name_;
566  format();
567  seek(m_edit_pos);
568  }
569 
570  void Text_Box::set_text(const String &text_) {
571  m_text.text = text_;
572  format();
573  seek(std::min(m_edit_pos, this->get_max_seek()));
574  }
575 
576  void Text_Box::set_text_color(const Color &text_color_) {
577  m_text.color = text_color_;
578  }
579 
580  void Text_Box::set_justify(const JUSTIFY &justify_) {
581  m_justify = justify_;
582  }
583 
584  void Text_Box::erase_lines(const unsigned int &begin, const unsigned int &end) {
585  String new_text;
586 
587  assert(begin <= end);
588  assert(end <= get_num_lines());
589 
590  for(unsigned int i = 0; i != begin; ++i)
591  new_text += m_lines[i].unformatted;
592  if(end != get_num_lines()) {
593  if(m_lines[end].endled)
594  new_text += m_lines[end].unformatted.substr(1u);
595  else
596  new_text += m_lines[end].unformatted;
597 
598  for(unsigned int i = end + 1; i != get_num_lines(); ++i)
599  new_text += m_lines[i].unformatted;
600  }
601 
602  m_text.text = new_text;
603 
604  format();
605  invalidate_edit_pos();
606  }
607 
609  return m_bg_renderer;
610  }
611 
613  if(delete_m_bg_renderer)
614  delete m_bg_renderer;
615  m_bg_renderer = renderer;
616  delete_m_bg_renderer = true;
617  }
618 
619  void Text_Box::lend_BG_Renderer(const Widget_Render_Function * const &renderer) {
620  give_BG_Renderer(const_cast<Widget_Render_Function * const &>(renderer));
621  delete_m_bg_renderer = false;
622  }
623 
624  void Text_Box::fax_BG_Renderer(const Widget_Render_Function * const &renderer) {
625  give_BG_Renderer(renderer->get_duplicate());
626  }
627 
628  void Text_Box::invalidate_edit_pos() {
629  m_edit_pos = -1;
630  m_cursor_index.x = -1;
631  m_cursor_index.y = -1;
632  }
633 
634  Widget_Input_Repeater::Widget_Input_Repeater(Widget &widget_,
635  const int &repeat_delay_,
636  const int &repeat_interval_)
637  : m_widget(&widget_),
638  m_repeat_delay(repeat_delay_),
639  m_repeat_interval(repeat_interval_),
640  m_last_repeated(0),
641  m_active(false)
642  {
643  }
644 
645  Widget * const & Widget_Input_Repeater::get_widget() const {return m_widget;}
646  const int & Widget_Input_Repeater::get_repeat_delay() const {return m_repeat_delay;}
647  const int & Widget_Input_Repeater::get_repeat_interval() const {return m_repeat_interval;}
648 
649  void Widget_Input_Repeater::set_widget(Widget &widget_) {m_widget = &widget_; set_busy(widget_.is_busy());}
650  void Widget_Input_Repeater::set_repeat_delay(const int &repeat_delay_) {m_repeat_delay = repeat_delay_;}
651  void Widget_Input_Repeater::set_repeat_interval(const int &repeat_interval_) {m_repeat_interval = repeat_interval_;}
652 
654  : m_busy_one(0)
655  {
656  }
657 
658  void Widgets::lend_Widget(Widget &widget) {
659  m_widgets.push_back(&widget);
660 
661  if(widget.is_busy()) {
662  assert(!m_busy_one);
663  m_busy_one = &widget;
664  set_busy(true);
665  }
666  }
667 
669  std::vector<Widget *>::iterator it = std::find(m_widgets.begin(), m_widgets.end(), &widget);
670  if(it != m_widgets.end())
671  m_widgets.erase(it);
672 
673  if(m_busy_one == &widget) {
674  m_busy_one = 0;
675  set_busy(false);
676  }
677  }
678 
679 }
680 
681 #include <Zeni/Font.hxx>
682 #include <Zeni/Material.hxx>
683 #include <Zeni/Projector.hxx>
684 #include <Zeni/Timer.hxx>
685 #include <Zeni/Video.hxx>
686 
687 #endif
void set_repeat_delay(const int &repeat_delay_=SDL_DEFAULT_REPEAT_DELAY)
Definition: Widget.hxx:650
virtual Widget_Renderer_Pair< T1, T2 > * get_duplicate() const
Definition: Widget.hxx:229
const Widget_Render_Function * get_Renderer() const
Get the current Widget_Render_Function.
Definition: Widget.hxx:122
Widget_Rectangle(const Point2f &upper_left_, const Point2f &lower_right_)
Definition: Widget.hxx:142
Widget_Renderer_Color(const Color &color_)
Definition: Widget.hxx:247
Widget_Renderer_Pair< T1, T2 > * make_Widget_Renderer_Pair(const T1 *const &first_, const bool &delete_first_, const T2 *const &second_, const bool &delete_second_)
Definition: Widget.hxx:234
const int & get_repeat_delay() const
Definition: Widget.hxx:646
Point2f get_end_point_b() const
Definition: Widget.hxx:391
GLuint color
Definition: glew.h:7185
The Video Rendering Singleton.
Definition: Video.h:71
const bool & is_editable() const
Definition: Widget.hxx:52
Colors & get_Colors()
Get access to the singleton.
Definition: Colors.cpp:51
A Radio Button.
Definition: Widget.h:558
GLclampf f
Definition: glew.h:3390
A Check Box.
Definition: Widget.h:501
void set_slider_radius(const float &radius_)
Definition: Widget.hxx:407
Point2f get_center() const
Definition: Widget.hxx:172
A Set of Radio Buttons.
Definition: Widget.h:527
const Font & get_Font() const
Definition: Widget.hxx:540
GLboolean invert
Definition: glew.h:1408
float get_width() const
Definition: Widget.hxx:168
void lend_Slider_Renderer(const Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget no ownership.
Definition: Widget.hxx:495
void lend_Renderer(const Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget no ownership.
Definition: Widget.hxx:133
const Point3f & get_end_point_a() const
Definition: Collision.h:260
void render() const
Definition: Widget.hxx:111
virtual void on_mouse_motion(const Point2i &pos)=0
void set_widget(Widget &widget_)
Definition: Widget.hxx:649
void fax_BG_Renderer(const Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget a copy.
Definition: Widget.hxx:624
const float & get_layer() const
Definition: Widget.hxx:56
void fax_Renderer(const Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget a copy.
Definition: Widget.hxx:138
const T1 *const & first() const
Definition: Widget.hxx:201
void give_BG_Renderer(Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget ownership.
Definition: Widget.hxx:612
Point2f get_lower_left() const
Definition: Widget.hxx:152
void invert_mouse_wheel(const bool &invert)
Definition: Widget.hxx:424
void set_font_name(const String &font_name_)
Definition: Widget.hxx:564
Point2f get_upper_right() const
Definition: Widget.hxx:160
void give_Renderer(Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget ownership.
Definition: Widget.hxx:126
virtual void render_to(const Widget &widget)
Definition: Widget.hxx:221
void lend_Text_Button_Renderer(const Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget no ownership.
Definition: Widget.hxx:473
const Point3f & get_end_point_b() const
Definition: Collision.h:261
void set_mouse_wheel_continuous_rate(const float &mouse_wheel_continuous_rate)
Definition: Widget.hxx:432
#define assert(x)
Definition: SDL_malloc.c:1234
const Range & get_range() const
Definition: Widget.hxx:440
void fax_Text_Button_Renderer(const Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget a copy.
Definition: Widget.hxx:478
JUSTIFY
Definition: Font.h:68
void set_slider_position(const float &slider_position_)
Definition: Widget.hxx:411
const float & get_slider_position() const
Definition: Widget.hxx:399
Collision Line Segment.
Definition: Collision.h:233
const Widget_Render_Function * get_Slider_Renderer() const
Get the current Widget_Render_Function.
Definition: Widget.hxx:482
size_t get_max_lines() const
Definition: Widget.hxx:560
virtual Widget_Render_Function * get_duplicate() const =0
A 3D Point represented with floats.
Definition: Coordinate.h:133
void erase_lines(const unsigned int &begin, const unsigned int &end)
Definition: Widget.hxx:584
DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y)
Retrieve the current state of the mouse.
Definition: SDL_mouse.c:382
void give_Slider_BG_Renderer(Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget ownership.
Definition: Widget.hxx:508
Keyboard button event structure (event.key.*)
Definition: SDL_events.h:176
A Featureful 3-Space Vector Class.
Definition: Vector3f.h:58
Widget_Renderer_Texture(const String &texture_)
Definition: Widget.hxx:252
ALuint u
Definition: alMain.h:58
const float & get_mouse_wheel_continuous_rate() const
Definition: Widget.hxx:428
const int & get_repeat_interval() const
Definition: Widget.hxx:647
int
Definition: SDL_systhread.c:37
void set_font(const String &font_)
Set the current font.
Definition: Widget.hxx:528
void give_Slider_Renderer(Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget ownership.
Definition: Widget.hxx:486
void set_justify(const JUSTIFY &justify_)
Definition: Widget.hxx:580
virtual void pop_world_stack()=0
Pop a model view matrix off the stack.
const String & get_Font() const
Get the current font.
Definition: Widget.hxx:524
#define true
Definition: ftrandom.c:49
void set_end_points(const Point2f &end_point_a_, const Point2f &end_point_b_)
Definition: Widget.hxx:403
virtual void on_key(const SDL_Keysym &, const bool &)
Definition: Widget.h:271
const Collision::Line_Segment & get_line_segment() const
Definition: Widget.hxx:436
void set_value(const int &value)
Definition: Widget.hxx:453
void fax_Slider_Renderer(const Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget a copy.
Definition: Widget.hxx:500
void on_event(const SDL_KeyboardEvent &event)
Definition: Widget.hxx:69
The Widget base class.
Definition: Widget.h:243
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl2ext.h:845
The 2D Projector.
Definition: Projector.h:86
Widget *const & get_widget() const
Definition: Widget.hxx:645
Font Abstraction.
Definition: Font.h:70
size_t get_num_lines() const
Definition: Widget.hxx:556
A Button Widget.
Definition: Widget.h:454
const Widget_Render_Function * get_BG_Renderer() const
Get the current Widget_Render_Function.
Definition: Widget.hxx:608
void lend_Widget(Widget &widget)
Definition: Widget.hxx:658
SDL_Keysym keysym
Definition: SDL_events.h:185
void give_Text_Button_Renderer(Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget ownership.
Definition: Widget.hxx:462
void set_text_color(const Color &text_color_)
Definition: Widget.hxx:576
Widget_Renderer_Text(const String &font_name_, const String &text_, const Color &color_)
Definition: Widget.hxx:240
const Point2f & get_lower_right() const
Definition: Widget.hxx:156
std::pair< int, int > Range
Definition: Widget.h:629
Mouse wheel event structure (event.wheel.*)
Definition: SDL_events.h:251
const T2 *const & second() const
Definition: Widget.hxx:206
virtual void push_world_stack()=0
Push a model view matrix onto the stack.
const Color & get_text_color() const
Definition: Widget.hxx:548
void lend_Slider_BG_Renderer(const Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget no ownership.
Definition: Widget.hxx:515
virtual void render_impl() const
Definition: Widget.cpp:40
int get_value() const
Definition: Widget.hxx:449
Vector3f unproject(const Vector3f &screen_coord) const
Map screen coordinates ([viewport.first.x, viewport.second.x], [viewport.first.y, viewport...
Definition: Projector.hxx:74
const bool & is_toggling() const
Definition: Widget.hxx:352
void fax_Slider_BG_Renderer(const Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget a copy.
Definition: Widget.hxx:520
GLenum GLenum GLuint texture
Definition: gl2ext.h:850
virtual ~Widget_Renderer_Pair()
Definition: Widget.hxx:193
EGLSurface EGLint void ** value
Definition: eglext.h:301
const State & get_State() const
Get the State of the button.
Definition: Widget.hxx:327
virtual void translate_scene(const Vector3f &direction)=0
Translate the scene.
#define const
Definition: zconf.h:91
void set_layer(const float &layer_=0.0f)
Definition: Widget.hxx:64
void accept(Radio_Button &radio_button)
Definition: Widget.hxx:368
Mouse motion event structure (event.motion.*)
Definition: SDL_events.h:218
void lend_BG_Renderer(const Widget_Render_Function *const &renderer)
Set the current Widget_Render_Function, giving the Widget no ownership.
Definition: Widget.hxx:619
Mouse button event structure (event.button.*)
Definition: SDL_events.h:234
Point2f get_end_point_a() const
Definition: Widget.hxx:387
void set_checked(const bool &checked_)
Definition: Widget.hxx:351
void set_text(const String &text_)
Definition: Widget.hxx:570
void set_range(const Range &range_)
Definition: Widget.hxx:444
const String & get_text() const
Definition: Widget.hxx:544
const bool & is_busy() const
Definition: Widget.hxx:48
void set_repeat_interval(const int &repeat_interval_=SDL_DEFAULT_REPEAT_INTERVAL)
Definition: Widget.hxx:651
GLuint GLuint end
Definition: glew.h:1239
const String & get_font_name() const
Definition: Widget.hxx:536
virtual void on_mouse_button(const Point2i &pos, const bool &down, const int &button)=0
bool is_inside(const Point2i &pos) const
Definition: Widget.hxx:177
Fonts & get_Fonts()
Get access to the singleton.
Definition: Fonts.cpp:60
const bool & is_checked() const
Definition: Widget.hxx:350
virtual void set_editable(const bool &editable_)
Definition: Widget.cpp:36
Video & get_Video()
Get access to the singleton.
Definition: Video.cpp:149
void seek(const int &edit_pos)
Definition: Widget.cpp:1274
#define min(x, y)
Definition: os.h:75
int i
Definition: pngrutil.c:1377
void set_busy(const bool &busy_)
Definition: Widget.hxx:60
const float & get_slider_radius() const
Definition: Widget.hxx:395
void unlend_Widget(Widget &widget)
Definition: Widget.hxx:668
const bool & is_mouse_wheel_inverted() const
Definition: Widget.hxx:420
int get_max_seek() const
Definition: Widget.cpp:1259
float get_height() const
Definition: Widget.hxx:164
A 2D Point represented with floats.
Definition: Coordinate.h:98
const Point2f & get_upper_left() const
Definition: Widget.hxx:148
Widget_Renderer_Pair(const T1 *const &first_, const bool &delete_first_, const T2 *const &second_, const bool &delete_second_)
Definition: Widget.hxx:183
Rectangle positioning.
Definition: Widget.h:430
#define false
Definition: ftrandom.c:50
Color.
Definition: Color.h:41
cl_event event
Definition: glew.h:3556
const Widget_Render_Function * get_Text_Button_Renderer() const
Get the current Widget_Render_Function.
Definition: Widget.hxx:458
unsigned int size_t
const JUSTIFY & get_justify() const
Definition: Widget.hxx:552
const Widget_Render_Function * get_Slider_BG_Renderer() const
Get the current Widget_Render_Function.
Definition: Widget.hxx:504
A 2D Point represented with integers.
Definition: Coordinate.h:85