Renamed private member functions in GLToolbar

This commit is contained in:
Enrico Turri 2018-08-24 12:32:14 +02:00
parent 8a9d0023a7
commit bfac36174f
2 changed files with 37 additions and 37 deletions

View File

@ -82,10 +82,10 @@ bool GLToolbarItem::is_separator() const
void GLToolbarItem::render(unsigned int tex_id, float left, float right, float bottom, float top, unsigned int texture_size, unsigned int border_size, unsigned int icon_size, unsigned int gap_size) const void GLToolbarItem::render(unsigned int tex_id, float left, float right, float bottom, float top, unsigned int texture_size, unsigned int border_size, unsigned int icon_size, unsigned int gap_size) const
{ {
GLTexture::render_sub_texture(tex_id, left, right, bottom, top, _get_uvs(texture_size, border_size, icon_size, gap_size)); GLTexture::render_sub_texture(tex_id, left, right, bottom, top, get_uvs(texture_size, border_size, icon_size, gap_size));
} }
GLTexture::Quad_UVs GLToolbarItem::_get_uvs(unsigned int texture_size, unsigned int border_size, unsigned int icon_size, unsigned int gap_size) const GLTexture::Quad_UVs GLToolbarItem::get_uvs(unsigned int texture_size, unsigned int border_size, unsigned int icon_size, unsigned int gap_size) const
{ {
GLTexture::Quad_UVs uvs; GLTexture::Quad_UVs uvs;
@ -209,11 +209,11 @@ float GLToolbar::get_width() const
default: default:
case Layout::Horizontal: case Layout::Horizontal:
{ {
return _get_width_horizontal(); return get_width_horizontal();
} }
case Layout::Vertical: case Layout::Vertical:
{ {
return _get_width_vertical(); return get_width_vertical();
} }
} }
} }
@ -225,11 +225,11 @@ float GLToolbar::get_height() const
default: default:
case Layout::Horizontal: case Layout::Horizontal:
{ {
return _get_height_horizontal(); return get_height_horizontal();
} }
case Layout::Vertical: case Layout::Vertical:
{ {
return _get_height_vertical(); return get_height_vertical();
} }
} }
} }
@ -279,12 +279,12 @@ void GLToolbar::update_hover_state(const Vec2d& mouse_pos)
default: default:
case Layout::Horizontal: case Layout::Horizontal:
{ {
_update_hover_state_horizontal(mouse_pos); update_hover_state_horizontal(mouse_pos);
break; break;
} }
case Layout::Vertical: case Layout::Vertical:
{ {
_update_hover_state_vertical(mouse_pos); update_hover_state_vertical(mouse_pos);
break; break;
} }
} }
@ -300,11 +300,11 @@ int GLToolbar::contains_mouse(const Vec2d& mouse_pos) const
default: default:
case Layout::Horizontal: case Layout::Horizontal:
{ {
return _contains_mouse_horizontal(mouse_pos); return contains_mouse_horizontal(mouse_pos);
} }
case Layout::Vertical: case Layout::Vertical:
{ {
return _contains_mouse_vertical(mouse_pos); return contains_mouse_vertical(mouse_pos);
} }
} }
} }
@ -358,12 +358,12 @@ void GLToolbar::render() const
default: default:
case Layout::Horizontal: case Layout::Horizontal:
{ {
_render_horizontal(); render_horizontal();
break; break;
} }
case Layout::Vertical: case Layout::Vertical:
{ {
_render_vertical(); render_vertical();
break; break;
} }
} }
@ -371,27 +371,27 @@ void GLToolbar::render() const
::glPopMatrix(); ::glPopMatrix();
} }
float GLToolbar::_get_width_horizontal() const float GLToolbar::get_width_horizontal() const
{ {
return _get_main_size(); return get_main_size();
} }
float GLToolbar::_get_width_vertical() const float GLToolbar::get_width_vertical() const
{ {
return m_icons_texture.items_icon_size; return m_icons_texture.items_icon_size;
} }
float GLToolbar::_get_height_horizontal() const float GLToolbar::get_height_horizontal() const
{ {
return m_icons_texture.items_icon_size; return m_icons_texture.items_icon_size;
} }
float GLToolbar::_get_height_vertical() const float GLToolbar::get_height_vertical() const
{ {
return _get_main_size(); return get_main_size();
} }
float GLToolbar::_get_main_size() const float GLToolbar::get_main_size() const
{ {
float size = 0.0f; float size = 0.0f;
for (unsigned int i = 0; i < (unsigned int)m_items.size(); ++i) for (unsigned int i = 0; i < (unsigned int)m_items.size(); ++i)
@ -408,7 +408,7 @@ float GLToolbar::_get_main_size() const
return size; return size;
} }
void GLToolbar::_update_hover_state_horizontal(const Vec2d& mouse_pos) void GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos)
{ {
float zoom = m_parent.get_camera_zoom(); float zoom = m_parent.get_camera_zoom();
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
@ -488,7 +488,7 @@ void GLToolbar::_update_hover_state_horizontal(const Vec2d& mouse_pos)
m_parent.set_tooltip(tooltip); m_parent.set_tooltip(tooltip);
} }
void GLToolbar::_update_hover_state_vertical(const Vec2d& mouse_pos) void GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos)
{ {
float zoom = m_parent.get_camera_zoom(); float zoom = m_parent.get_camera_zoom();
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
@ -568,7 +568,7 @@ void GLToolbar::_update_hover_state_vertical(const Vec2d& mouse_pos)
m_parent.set_tooltip(tooltip); m_parent.set_tooltip(tooltip);
} }
int GLToolbar::_contains_mouse_horizontal(const Vec2d& mouse_pos) const int GLToolbar::contains_mouse_horizontal(const Vec2d& mouse_pos) const
{ {
float zoom = m_parent.get_camera_zoom(); float zoom = m_parent.get_camera_zoom();
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
@ -609,7 +609,7 @@ int GLToolbar::_contains_mouse_horizontal(const Vec2d& mouse_pos) const
return -1; return -1;
} }
int GLToolbar::_contains_mouse_vertical(const Vec2d& mouse_pos) const int GLToolbar::contains_mouse_vertical(const Vec2d& mouse_pos) const
{ {
float zoom = m_parent.get_camera_zoom(); float zoom = m_parent.get_camera_zoom();
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
@ -650,7 +650,7 @@ int GLToolbar::_contains_mouse_vertical(const Vec2d& mouse_pos) const
return -1; return -1;
} }
void GLToolbar::_render_horizontal() const void GLToolbar::render_horizontal() const
{ {
unsigned int tex_id = m_icons_texture.texture.get_id(); unsigned int tex_id = m_icons_texture.texture.get_id();
int tex_size = m_icons_texture.texture.get_width(); int tex_size = m_icons_texture.texture.get_width();
@ -684,7 +684,7 @@ void GLToolbar::_render_horizontal() const
} }
} }
void GLToolbar::_render_vertical() const void GLToolbar::render_vertical() const
{ {
unsigned int tex_id = m_icons_texture.texture.get_id(); unsigned int tex_id = m_icons_texture.texture.get_id();
int tex_size = m_icons_texture.texture.get_width(); int tex_size = m_icons_texture.texture.get_width();

View File

@ -69,7 +69,7 @@ public:
void render(unsigned int tex_id, float left, float right, float bottom, float top, unsigned int texture_size, unsigned int border_size, unsigned int icon_size, unsigned int gap_size) const; void render(unsigned int tex_id, float left, float right, float bottom, float top, unsigned int texture_size, unsigned int border_size, unsigned int icon_size, unsigned int gap_size) const;
private: private:
GLTexture::Quad_UVs _get_uvs(unsigned int texture_size, unsigned int border_size, unsigned int icon_size, unsigned int gap_size) const; GLTexture::Quad_UVs get_uvs(unsigned int texture_size, unsigned int border_size, unsigned int icon_size, unsigned int gap_size) const;
}; };
class GLToolbar class GLToolbar
@ -155,18 +155,18 @@ public:
void render() const; void render() const;
private: private:
float _get_width_horizontal() const; float get_width_horizontal() const;
float _get_width_vertical() const; float get_width_vertical() const;
float _get_height_horizontal() const; float get_height_horizontal() const;
float _get_height_vertical() const; float get_height_vertical() const;
float _get_main_size() const; float get_main_size() const;
void _update_hover_state_horizontal(const Vec2d& mouse_pos); void update_hover_state_horizontal(const Vec2d& mouse_pos);
void _update_hover_state_vertical(const Vec2d& mouse_pos); void update_hover_state_vertical(const Vec2d& mouse_pos);
int _contains_mouse_horizontal(const Vec2d& mouse_pos) const; int contains_mouse_horizontal(const Vec2d& mouse_pos) const;
int _contains_mouse_vertical(const Vec2d& mouse_pos) const; int contains_mouse_vertical(const Vec2d& mouse_pos) const;
void _render_horizontal() const; void render_horizontal() const;
void _render_vertical() const; void render_vertical() const;
}; };
} // namespace GUI } // namespace GUI