24 #if defined(_DEBUG) && defined(_WINDOWS)
25 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
37 m_editable = editable_;
46 m_upper_left = upper_left_;
50 m_lower_right = lower_right_;
62 const float x = center.
x;
200 const Slider *
const sr =
dynamic_cast<const Slider *
>(&widget);
291 else if(m_state ==
NORMAL) {
310 #if SDL_VERSION_ATLEAST(2,0,0)
311 void Widget_Button::on_mouse_wheel(
const Zeni::Point2i &,
const int &) {
316 m_checked = !m_checked;
342 m_radio_button_set->
accept(*
this);
350 for(std::set<Radio_Button *>::iterator it = m_radio_buttons.begin(); it != m_radio_buttons.end(); ++it)
351 (*it)->on_mouse_button(pos, down, button);
358 for(std::set<Radio_Button *>::iterator it = m_radio_buttons.begin(); it != m_radio_buttons.end(); ++it)
359 (*it)->on_mouse_motion(pos);
363 for(std::set<Radio_Button *>::const_iterator it = m_radio_buttons.begin(); it != m_radio_buttons.end(); ++it)
364 (*it)->render_impl();
368 const float &slider_radius_,
369 const float &slider_position_)
371 m_slider_radius(slider_radius_),
372 m_mouse_wheel_inverted(
false),
373 m_mouse_wheel_continuous_rate(0.01
f),
374 m_slider_position(slider_position_),
386 const Point3f mouse_pos(
float(pos.
x),
float(pos.
y), 0.0f);
388 const std::pair<float, float> test = m_line_segment.
nearest_point(mouse_pos);
389 if(test.first < m_slider_radius) {
391 m_backup_position = m_slider_position;
392 m_slider_position = test.second;
411 const Point3f mouse_pos(
float(pos.
x),
float(pos.
y), 0.0f);
413 const std::pair<float, float> test = m_line_segment.
nearest_point(mouse_pos);
414 if(test.first < m_slider_radius) {
415 m_slider_position = test.second;
419 m_slider_position = m_backup_position;
425 #if SDL_VERSION_ATLEAST(2,0,0)
426 void Slider::on_mouse_wheel(
const Zeni::Point2i &pos,
const int &up) {
428 const Point3f mouse_pos(
float(pos.
x),
float(pos.
y), 0.0f);
433 m_slider_position =
std::max(0.0
f,
std::min(1.0
f, m_slider_position + m_mouse_wheel_continuous_rate * up_));
450 const float &slider_radius_,
451 const float &slider_position_)
452 :
Slider(end_point_a_, end_point_b_, slider_radius_, slider_position_),
455 assert(range.first <= range.second);
459 #if SDL_VERSION_ATLEAST(2,0,0)
460 void Slider_Int::on_mouse_wheel(
const Zeni::Point2i &pos,
const int &up) {
461 Slider::on_mouse_wheel(pos, up);
468 if(down || (button != SDL_BUTTON_WHEELDOWN && button != SDL_BUTTON_WHEELUP))
478 const Point3f mouse_pos(
float(pos.
x),
float(pos.
y), 0.0f);
494 Selector::Normal_Button::Normal_Button(
Selector &selector,
497 :
Text_Button(upper_left_, lower_right_, selector.m_font,
""),
498 m_selector(&selector)
503 void Selector::Normal_Button::on_accept() {
504 m_selector->decide_visible(m_selector->m_option);
505 m_selector->m_selected =
true;
507 m_selector->set_busy(
true);
508 m_selector->set_layer(-0.5
f);
511 Selector::Selector_Button::Selector_Button(Selector &selector,
513 const Point2f &upper_left_,
514 const Point2f &lower_right_)
515 : Text_Button(upper_left_, lower_right_, selector.m_font, option),
516 m_selector(&selector)
521 void Selector::Selector_Button::on_accept() {
522 m_selector->on_accept(text);
523 m_selector->m_selected =
false;
526 Selector::Selector_Slider::Selector_Slider(Selector &selector,
527 const float &slider_radius_,
528 const std::pair<float, float> &bg_coordinates_)
529 : Widget_Rectangle(Point2f(bg_coordinates_.
first, 0.0
f),
530 Point2f(bg_coordinates_.second, 0.0
f)),
531 Slider_Int(Range(0
u, 1
u),
532 Point2f(), Point2f(),
534 m_selector(&selector)
539 void Selector::Selector_Slider::set_end_points(
const Point2f &end_point_a_,
const Point2f &end_point_b_) {
540 set_upper_left(Point2f(get_upper_left().
x, end_point_a_.y - get_slider_radius()));
541 set_lower_right(Point2f(get_lower_right().
x, end_point_b_.y + get_slider_radius()));
546 void Selector::Selector_Slider::on_slide() {
548 m_selector->decide_visible(
size_t(get_value()));
551 void Selector::Selector_Slider::render_impl()
const {
552 m_selector->m_slider_bg_renderer->render_to(*
this);
557 const Point2f &expanded_upper_left_,
const Point2f &expanded_lower_right_,
560 #pragma warning( push )
561 #pragma warning( disable : 4355 )
564 delete_m_button_renderer(
true),
566 delete_m_slider_renderer(
true),
568 delete_m_slider_bg_renderer(
true),
570 m_expanded(expanded_upper_left_, expanded_lower_right_),
573 m_normal_button(*
this, upper_left_, lower_right_),
574 m_selector_slider(*
this,
575 0.5
f * (expanded_lower_right_.
x - lower_right_.
x),
576 std::make_pair(lower_right_.
x, expanded_lower_right_.
x))
578 #pragma warning( pop )
581 m_selector_slider.invert_mouse_wheel(
true);
583 m_normal_button.lend_Renderer(m_button_renderer);
584 m_selector_slider.lend_Renderer(m_slider_renderer);
590 if(delete_m_button_renderer)
591 delete m_button_renderer;
592 if(delete_m_slider_renderer)
593 delete m_slider_renderer;
594 if(delete_m_slider_bg_renderer)
595 delete m_slider_bg_renderer;
603 if(m_options.empty())
605 m_options.push_back(option);
607 add_selector_button(option);
611 Options::iterator it = std::find(m_options.begin(), m_options.end(),
option);
612 if(it != m_options.end())
615 build_selector_buttons();
619 if(!m_options.empty())
620 return m_options[m_option];
625 Options::iterator it = std::find(m_options.begin(), m_options.end(),
option);
626 if(it != m_options.end())
627 m_option =
size_t(it - m_options.begin());
629 m_normal_button.text = m_options[m_option];
638 m_normal_button.on_mouse_button(pos, down, button);
640 const std::pair<Point2f, Point2f>
v = visible_region();
642 if(pos.
x < v.first.x || pos.
x > v.second.x || pos.
y < v.first.y || pos.
y > v.second.y) {
651 const Point2i offset_pos(pos.
x,
int(pos.
y + vertical_offset()));
652 for(
size_t i = view_start;
i != view_end; ++
i)
656 #if !SDL_VERSION_ATLEAST(2,0,0)
657 if(button == SDL_BUTTON_WHEELDOWN || button == SDL_BUTTON_WHEELUP) {
658 const Point2f &
a = m_selector_slider.get_end_point_a();
659 m_selector_slider.on_mouse_button(
Point2i(
int(a.
x),
int(a.
y)), down, button);
663 m_selector_slider.on_mouse_button(pos, down, button);
670 #if SDL_VERSION_ATLEAST(2,0,0)
671 void Selector::on_mouse_wheel(
const Zeni::Point2i &pos,
const int &up) {
677 m_normal_button.on_mouse_wheel(pos, up);
679 const std::pair<Point2f, Point2f>
v = visible_region();
681 if(pos.
x >= v.first.x && pos.
x <= v.second.x && pos.
y >= v.first.y && pos.
y <= v.second.y) {
682 const Point2i offset_pos(pos.
x,
int(pos.
y + vertical_offset()));
683 for(
size_t i = view_start;
i != view_end; ++
i)
684 m_selector_buttons[
i]->on_mouse_wheel(offset_pos, up);
687 const Point2f &
a = m_selector_slider.get_end_point_a();
688 m_selector_slider.on_mouse_wheel(
Point2i(
int(a.
x),
int(a.
y)), up);
701 m_normal_button.on_mouse_motion(pos);
703 const Point2i offset_pos(pos.
x,
int(pos.
y + vertical_offset()));
704 for(
size_t i = view_start;
i != view_end; ++
i)
708 m_selector_slider.on_mouse_motion(pos);
721 m_normal_button.render_impl();
727 for(
size_t i = view_start;
i != view_end; ++
i)
733 m_selector_slider.render_impl();
737 float Selector::button_height()
const {
738 const Point2f &ul = m_normal_button.get_upper_left();
739 const Point2f &lr = m_normal_button.get_lower_right();
743 float Selector::vertical_offset()
const {
744 return float(view_offset) * button_height();
747 void Selector::decide_visible(
const size_t ¢ered) {
748 const Point2f &nul = m_normal_button.get_upper_left();
749 const Point2f &nlr = m_normal_button.get_lower_right();
753 const size_t slots_above =
size_t((nul.y - eul.y) / button_height());
754 const size_t slots_below =
size_t((elr.y - nlr.y) / button_height());
755 size_t needed_above = centered;
756 size_t needed_below = m_options.size() - centered - 1
u;
758 view_start = centered -
std::min(slots_above, needed_above);
759 view_end = centered +
std::min(slots_below, needed_below) + 1
u;
760 view_offset = centered;
763 while(needed_above < slots_above && needed_below > slots_below) {
771 while(needed_below < slots_below && needed_above > slots_above) {
781 if(needed_above > slots_above)
782 view_hidden += needed_above - slots_above;
783 if(needed_below > slots_below)
784 view_hidden += needed_below - slots_below;
787 const std::pair<Point2f, Point2f> v = visible_region();
788 const float r = m_selector_slider.get_slider_radius();
789 const float hx = 0.5f * (m_normal_button.get_lower_right().x + m_expanded.
get_lower_right().
x);
791 m_selector_slider.set_end_points(Point2f(hx, v.first.y + r), Point2f(hx, v.second.y - r));
792 m_selector_slider.set_range(std::make_pair(
int(view_offset - needed_above + slots_above),
793 int(view_offset + needed_below - slots_below)));
794 m_selector_slider.set_value(
int(view_offset));
798 std::pair<Point2f, Point2f> Selector::visible_region()
const {
799 const Point2f &ul = m_normal_button.get_upper_left();
800 const Point2f &lr = m_normal_button.get_lower_right();
801 const float bh = button_height();
802 const float ex = view_hidden ? 2.0f * m_selector_slider.get_slider_radius() : 0.0f;
803 return std::make_pair(Point2f(ul.x, ul.y - bh *
float(view_offset - view_start)),
804 Point2f(lr.x + ex, ul.y + bh *
float(view_end - view_offset)));
807 void Selector::add_selector_button(
const String &
option) {
808 const Point2f &ul = m_normal_button.get_upper_left();
809 const Point2f &lr = m_normal_button.get_lower_right();
810 const float vertical_offset = float(m_selector_buttons.size()) * (lr.y - ul.y);
811 m_selector_buttons.push_back(
new Selector_Button(*
this, option,
812 Point2f(ul.x, ul.y + vertical_offset),
813 Point2f(lr.x, lr.y + vertical_offset)));
816 void Selector::build_selector_buttons() {
819 for(Options::const_iterator it = m_options.begin(); it != m_options.end(); ++it)
820 add_selector_button(*it);
823 void Selector::clear() {
824 for(std::vector<Selector_Button *>::const_iterator it = m_selector_buttons.begin(); it != m_selector_buttons.end(); ++it)
826 m_selector_buttons.clear();
831 const bool &editable_,
const JUSTIFY &justify_,
const int &tab_spaces_)
834 m_text(font_name_, clean_string(text_), text_color_),
838 m_tab_spaces(tab_spaces_),
839 m_cursor_index(-1, -1)
848 get_text_boxes().insert(
this);
854 get_text_boxes().erase(
this);
856 if(delete_m_bg_renderer)
857 delete m_bg_renderer;
862 if(down && m_edit_pos != -1) {
866 #if SDL_VERSION_ATLEAST(1,3,0)
873 const bool mod_none = !mod_alt && !mod_ctrl && !mod_gui && !mod_shift;
874 const bool mod_ctrl_only = !mod_alt && mod_ctrl && !mod_gui && !mod_shift;
875 const bool mod_shift_only = !mod_alt && !mod_ctrl && !mod_gui && mod_shift;
889 seek(m_edit_pos - 1);
900 if(m_edit_pos <
int(t.
size())) {
913 if(mod_none || mod_ctrl_only)
917 else if(m_cursor_index.
x) {
919 if(m_lines[
size_t(m_cursor_index.
y)].endled)
927 if(mod_none || mod_ctrl_only)
929 int cursor_pos = mod_ctrl ?
931 get_cursor_pos() - m_cursor_index.
x +
int(m_lines[
size_t(m_cursor_index.
y)].unformatted.size());
938 seek(m_edit_pos - 1);
942 seek(m_edit_pos + 1);
946 if(m_cursor_index.
y) {
948 for(
size_t i = 0u, iend = m_cursor_index.
y - 1u;
i != iend; ++
i)
949 count += m_lines[
i].unformatted.size();
950 count +=
std::min(
size_t(m_cursor_index.
x), m_lines[m_cursor_index.
y - 1u].unformatted.size());
957 if(m_cursor_index.
y + 1 <
int(m_lines.size())) {
959 for(
size_t i = 0u, iend = m_cursor_index.
y + 1u;
i != iend; ++
i)
960 count += m_lines[
i].unformatted.size();
961 count +=
std::min(
size_t(m_cursor_index.
x), m_lines[m_cursor_index.
y + 1u].unformatted.size());
967 if(mod_none || mod_shift_only)
973 String next = clean_string(t0 + c + t1);
978 seek(m_edit_pos + 1);
997 const bool was_focused = m_edit_pos != -1;
998 invalidate_edit_pos();
1002 if(m_edit_pos == -1) {
1014 size_t j = 0, jend = m_lines.size();
1015 for(; j != jend && m_cursor_pos.
y > m_lines[
j].glyph_top; ++
j);
1037 int i = 0, iend =
int(m_lines[j].unformatted_glyph_sides.size());
1038 for(; i != iend && m_cursor_pos.
x > x_pos + m_lines[
j].unformatted_glyph_sides[
size_t(i)]; ++
i);
1043 if(i + 1 != iend && m_cursor_pos.
x > x_pos + (0.2f * m_lines[j].unformatted_glyph_sides[
size_t(i)] +
1044 0.8f * m_lines[j].unformatted_glyph_sides[i + 1u]))
1050 for(
size_t k = 0;
k <
j; ++
k)
1051 m_edit_pos +=
int(m_lines[
k].unformatted.size());
1057 for(
size_t m = 0u, mend = m_lines.size();
m != mend; ++
m)
1058 count += m_lines[
m].unformatted.size();
1093 for(
size_t i = 0u, iend = m_lines.size();
i != iend; ++
i)
1094 f.
render_text(m_lines[
i].formatted,
Point2f(x_pos, y_offset + m_lines[i].glyph_top), c, m_justify);
1096 if(m_cursor_index.
x != -1 && m_cursor_index.
y != -1
1100 Point2f p0(x_pos + m_lines[
size_t(m_cursor_index.
y)].unformatted_glyph_sides[
size_t(m_cursor_index.
x)],
1105 p0.
x -= f.
get_text_width(m_lines[
size_t(m_cursor_index.
y)].formatted) / 2.0f;
1116 vr.
render(visible_cursor);
1120 void Text_Box::format() {
1122 m_lines.push_back(Line());
1126 const float mll = max_line_width();
1131 std::list<Word> words;
1134 for(
unsigned int i = 0, iend = static_cast<unsigned int>(t.
size());
i != iend; ++
i) {
1137 if(next_word.type) {
1138 if(next_word.type != type || t[
i] ==
'\n') {
1139 words.push_back(next_word);
1140 next_word = Word(type);
1144 next_word.type =
type;
1146 next_word.unformatted += t[
i];
1148 const float next_width = get_text_width(f, next_word.unformatted);
1149 next_word.unformatted_glyph_sides.push_back(next_width);
1150 if(type != Word::SPACE && next_width > mll)
1151 next_word.splittable =
true;
1153 if(next_word.type != Word::NONSENSE)
1154 words.push_back(next_word);
1156 for(std::list<Word>::iterator it = words.begin(); it != words.end(); ++it)
1159 float glyph_top = 0.0f;
1160 for(std::vector<Line>::iterator it = m_lines.begin(); it != m_lines.end(); ++it) {
1161 it->formatted = untablinebreak(it->unformatted);
1163 it->formatted +=
"-";
1164 it->glyph_top = glyph_top;
1165 if(!it->unformatted.empty() && it->unformatted[0] ==
'\n')
1172 void Text_Box::append_word(
const Word &word) {
1174 const float mll = max_line_width();
1176 if(!word.unformatted.empty() && word.unformatted[0] ==
'\n')
1177 m_lines.push_back(Line());
1179 Line &
l = *m_lines.rbegin();
1180 float next_sum = get_text_width(f, l.unformatted + word.unformatted);
1182 if(word.type != Word::SPACE && next_sum > mll && !word.fpsplit) {
1183 if(word.splittable) {
1184 size_t i = 0
u, iend = word.unformatted.size();
1185 for(; i != iend && get_text_width(f, l.unformatted + word.unformatted.substr(0u, i) +
"-") < mll; ++
i);
1186 if(!l.unformatted.empty())
1188 if(i != 0u && i !=
size_t(-1)) {
1190 Word first_word(word.type);
1191 first_word.unformatted = word.unformatted.substr(0, i);
1192 for(
size_t j = 1u, jend = first_word.unformatted.size();
j <= jend; ++
j)
1193 first_word.unformatted_glyph_sides.push_back(get_text_width(f, first_word.unformatted.substr(0u,
j)));
1194 first_word.fpsplit =
true;
1195 append_word(first_word);
1199 Word second_word(word.type);
1200 second_word.unformatted = word.unformatted.substr(i, word.unformatted.size() -
i);
1201 for(
size_t j = 1u, jend = second_word.unformatted.size();
j <= jend; ++
j)
1202 second_word.unformatted_glyph_sides.push_back(get_text_width(f, second_word.unformatted.substr(0u,
j)));
1203 second_word.splittable = get_text_width(f, second_word.unformatted) > mll;
1204 append_word(second_word);
1208 Word only_word(word);
1209 only_word.fpsplit = l.unformatted.empty();
1210 m_lines.push_back(Line());
1211 append_word(only_word);
1216 m_lines.push_back(Line());
1221 for(
unsigned int i = 0u, iend = static_cast<unsigned int>(word.unformatted.size()); i != iend; ++
i) {
1222 l.unformatted += word.unformatted[
i];
1223 l.unformatted_glyph_sides.push_back(get_text_width(f, l.unformatted));
1226 l.fpsplit = word.fpsplit;
1233 invalidate_edit_pos();
1254 for(
size_t j = 0u, jend =
size_t(m_cursor_index.
y);
j != jend; ++
j)
1255 count += m_lines[
j].unformatted_glyph_sides.size();
1264 if(!m_lines.empty()) {
1266 for(std::vector<Line>::const_iterator it = m_lines.begin(); it != m_lines.end(); ++it)
1267 count += it->unformatted_glyph_sides.size();
1281 edit_pos >
int(t.
size()))
1284 m_edit_pos = edit_pos;
1285 size_t j = 0
u, jend = m_lines.size();
1286 int count = 0, i = -1, iend;
1287 for(; j != jend; ++
j) {
1288 iend =
int(m_lines[j].unformatted.size());
1290 if(count + iend < edit_pos) {
1295 i = edit_pos -
count;
1309 size_t j = 0
u, jend = m_lines.size();
1310 int edit_count = 0,
count = 0, i = -1, iend;
1311 for(; j != jend; ++
j) {
1312 iend =
int(m_lines[j].unformatted_glyph_sides.size());
1314 if(
count + iend <= cursor_pos) {
1316 edit_count +=
int(m_lines[j].unformatted.size());
1320 i = cursor_pos -
count;
1326 m_edit_pos = edit_count;
1339 const bool was_focused = m_edit_pos != -1;
1345 const bool was_focused = m_edit_pos != -1;
1346 invalidate_edit_pos();
1352 String Text_Box::clean_string(
const String &unclean_string)
const {
1356 *it ==
'\n' || *it ==
'\t')
1361 String Text_Box::untablinebreak(
const String &tabbed_text)
const {
1362 String untabbed_text;
1364 for(String::const_iterator it = tabbed_text.begin(); it != tabbed_text.end(); ++it) {
1367 untabbed_text += *it;
1370 for(
int i = m_tab_spaces;
i; --
i)
1371 untabbed_text +=
' ';
1374 return untabbed_text;
1377 float Text_Box::get_text_width(
const Font &font,
const String &text) {
1378 const String untabbed_text = untablinebreak(text);
1380 if(font.get_text_width(
" "))
1381 return font.get_text_width(untabbed_text);
1384 for(String::const_iterator it = untabbed_text.begin(); it != untabbed_text.end(); ++it)
1390 return font.get_text_width(fake_text);
1393 float Text_Box::max_line_width()
const {
1398 std::set<Text_Box *> &text_boxes = get_text_boxes();
1400 for(std::set<Text_Box *>::iterator it = text_boxes.begin(); it != text_boxes.end(); ++it) {
1402 (*it)->seek((*it)->get_edit_pos());
1406 std::set<Text_Box *> & Text_Box::get_text_boxes() {
1407 static std::set<Text_Box *> text_boxes;
1421 m_delay_finished =
false;
1423 m_widget->
on_key(m_keysym, m_down);
1457 if((m_delay_finished && ticks > m_repeat_interval) ||
1458 (!m_delay_finished && ticks > m_repeat_delay))
1460 m_delay_finished =
true;
1461 m_last_repeated = current_time;
1462 m_widget->
on_key(m_keysym, m_down);
1481 m_busy_one->
on_key(keysym, down);
1491 for(std::vector<Widget *>::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it) {
1492 (*it)->on_key(keysym, down);
1494 if(!m_busy_one && (*it)->
is_busy()) {
1518 for(std::vector<Widget *>::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it) {
1519 (*it)->on_mouse_button(pos, down, button);
1521 if(!m_busy_one && (*it)->
is_busy()) {
1544 for(std::vector<Widget *>::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it) {
1545 (*it)->on_mouse_motion(pos);
1547 if(!m_busy_one && (*it)->
is_busy()) {
1555 #if SDL_VERSION_ATLEAST(2,0,0)
1556 void Widgets::on_mouse_wheel(
const Zeni::Point2i &pos,
const int &up) {
1561 m_busy_one->on_mouse_wheel(pos, up);
1571 for(std::vector<Widget *>::iterator it = m_widgets.begin(); it != m_widgets.end(); ++it) {
1572 (*it)->on_mouse_wheel(pos, up);
1574 if(!m_busy_one && (*it)->is_busy()) {
1586 for(std::vector<Widget *>::const_reverse_iterator it = m_widgets.rbegin(), iend = m_widgets.rend(); it != iend; ++it)
1587 (*it)->perform_logic();
1593 for(std::vector<Widget *>::const_reverse_iterator it = m_widgets.rbegin(), iend = m_widgets.rend(); it != iend; ++it)
1597 Text_Box::Reinit Text_Box::g_reinit;
virtual float get_text_width(const String &text) const =0
Get the width of text rendering using this font. Approximately text_height * text.length() / 2.0f.
static bool widget_layer_less(const Widget *const &lhs, const Widget *const &rhs)
virtual void on_mouse_motion(const Point2i &pos)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
int32_t Sint32
A signed 32-bit integer type.
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Point2f get_end_point_b() const
An Abstraction of a Line.
virtual void on_mouse_motion(const Point2i &pos)
virtual void on_accept()
Called when the cursor is released inside the button.
The Video Rendering Singleton.
virtual void on_mouse_button(const Point2i &pos, const bool &down, const int &button)
An Abstraction of a Vertex in 2-space, colored.
Colors & get_Colors()
Get access to the singleton.
const Font & get_Font() const
bool get_key_state(const int &key) const
Get the state of a key.
A Font database read in from a file.
virtual void on_key(const SDL_Keysym &keysym, const bool &down)
An Abstraction of a Material.
GLfloat GLfloat GLfloat GLfloat v3
static void reformat_all()
Reformat all Text_Box instances.
GLboolean GLboolean GLboolean GLboolean a
#define SDL_DEFAULT_REPEAT_DELAY
virtual void render_to(const Widget &widget)
rect must be of type Widget_Rectangle
virtual void render_impl() const
The SDL keysym structure, used in key events.
An Abstraction of a Quadrilateral.
Tick_Type get_ticks_since(const Time &time) const
Get the number of clock ticks passed between 'time' and this Time.
virtual void on_mouse_button(const Point2i &pos, const bool &down, const int &button)
const Range & get_range() const
static void remove_post_reinit(Event::Handler *const &handler)
const float & get_slider_position() const
void lend_post_reinit(Event::Handler *const &handler)
Game & get_Game()
Get access to the singleton.
String substr(size_t pos=0, size_t n=npos) const
virtual Widget_Renderer_Text * get_duplicate() const
static char to_char(const SDL_Keysym &ks)
Returns a character key corresponding to the current combination of keys pressed or the null characte...
virtual void on_click()
Called when the cursor downclicks the button.
A 3D Point represented with floats.
static long get_time(void)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
virtual void on_stray()
Called when the cursor is dragged off the button after being clicked.
void add_option(const String &option)
Timer & get_Timer()
Get access to the singleton.
A Featureful 3-Space Vector Class.
Widget_Renderer_Texture(const String &texture_)
virtual void set_upper_left(const Point2f &upper_left_)
virtual void set_lower_right(const Point2f &lower_right_)
virtual void set_editable(const bool &editable_)
virtual void pop_world_stack()=0
Pop a model view matrix off the stack.
virtual void render(const Renderable &renderable)=0
Render a Renderable.
void set_end_points(const Point2f &end_point_a_, const Point2f &end_point_b_)
const Collision::Line_Segment & get_line_segment() const
void set_value(const int &value)
virtual void on_accept()
Called when the cursor is released inside the button.
virtual void render_to(const Widget &widget)
rect must be of type Widget_Rectangle
Time get_time()
Get the current Time.
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum format
virtual void on_reject()
Called when the cursor is released outside the button.
const Options & get_options() const
void remove_option(const String &option)
void select_option(const String &option)
String get_selected() const
Widget_Renderer_Text(const String &font_name_, const String &text_, const Color &color_)
std::pair< int, int > Range
int get_max_cursor_seek() const
virtual void render_impl() const
virtual void push_world_stack()=0
Push a model view matrix onto the stack.
int get_cursor_pos() const
const bool & is_toggling() const
EGLSurface EGLint EGLint y
GLenum GLenum GLuint texture
EGLSurface EGLint void ** value
virtual void translate_scene(const Vector3f &direction)=0
Translate the scene.
An Abstraction of a Vertex in 2-space, textured.
std::pair< float, float > nearest_point(const Line_Segment &rhs) const
Returns <distance, interpolation value [0.0f, 1.0f]>
virtual void on_accept(const String &option)
Point2f get_end_point_a() const
const int & get_edit_pos() const
std::vector< String > Options
const String & get_text() const
GLdouble GLdouble GLdouble r
void seek_cursor(const int &cursor_pos)
virtual void on_mouse_button(const Point2i &pos, const bool &down, const int &button)
Fonts & get_Fonts()
Get access to the singleton.
const bool & is_checked() const
Video & get_Video()
Get access to the singleton.
void seek(const int &edit_pos)
float get_text_height() const
Get the height of the font. The width is usually half the height, by default.
virtual void on_unstray()
Called when the cursor is dragged back onto the button without releasing the clicker.
virtual void on_mouse_button(const Point2i &pos, const bool &down, const int &button)
const float & get_slider_radius() const
void lend_Material(const Material *const &material)
Set the Material, giving the Renderable no ownership.
const bool & is_mouse_wheel_inverted() const
virtual void on_unfocus()
void set_focus(const bool &value)
A 2D Point represented with floats.
Vector3f normalized() const
Get the normalized vector.
GLfloat GLfloat GLfloat v2
virtual Widget_Renderer_Texture * get_duplicate() const
virtual void render_text(const String &text, const Point2f &position, const Color &color, const JUSTIFY &justify=ZENI_DEFAULT_JUSTIFY) const =0
Render text at screen position (x, y), with justification JUSTIFY.
A 2D Point represented with integers.
#define ZENI_TEXT_CURSOR_WIDTH