From: Mikko Rasa Date: Thu, 19 Sep 2019 16:33:30 +0000 (+0300) Subject: Rename Widget::on_geometry_change to on_size_change X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=7286d604956ddffcbfa2df6567de866f3d5df3a2;p=libs%2Fgltk.git Rename Widget::on_geometry_change to on_size_change The new name better represents its actual function. --- diff --git a/source/dropdown.cpp b/source/dropdown.cpp index ef0fa22..f922001 100644 --- a/source/dropdown.cpp +++ b/source/dropdown.cpp @@ -108,7 +108,7 @@ bool Dropdown::navigate(Navigation nav) return true; } -void Dropdown::on_geometry_change() +void Dropdown::on_size_change() { if(dropped) resize_list(); diff --git a/source/dropdown.h b/source/dropdown.h index 9b8a923..2d3feb3 100644 --- a/source/dropdown.h +++ b/source/dropdown.h @@ -60,7 +60,7 @@ public: virtual void button_press(int, int, unsigned); virtual bool navigate(Navigation); private: - virtual void on_geometry_change(); + virtual void on_size_change(); virtual void on_style_change(); void open_list(); diff --git a/source/entry.cpp b/source/entry.cpp index 606f447..3a91f50 100644 --- a/source/entry.cpp +++ b/source/entry.cpp @@ -369,7 +369,7 @@ void Entry::animate(const Time::TimeDelta &) rebuild(); } -void Entry::on_geometry_change() +void Entry::on_size_change() { if(multiline) check_view_range(); diff --git a/source/entry.h b/source/entry.h index 58e45fb..bd1fe2c 100644 --- a/source/entry.h +++ b/source/entry.h @@ -95,7 +95,7 @@ public: virtual bool navigate(Navigation); virtual void animate(const Time::TimeDelta &); private: - virtual void on_geometry_change(); + virtual void on_size_change(); virtual void on_style_change(); void move_edit_position(Navigation, bool); diff --git a/source/hslider.cpp b/source/hslider.cpp index 2af6f5a..1b6fadf 100644 --- a/source/hslider.cpp +++ b/source/hslider.cpp @@ -62,7 +62,7 @@ void HSlider::pointer_motion(int x, int) drag(x); } -void HSlider::on_geometry_change() +void HSlider::on_size_change() { drag_area_size = geom.w-total_margin; } @@ -80,7 +80,7 @@ void HSlider::on_style_change() total_margin = margin.left+margin.right; } - on_geometry_change(); + on_size_change(); } } // namespace GLtk diff --git a/source/hslider.h b/source/hslider.h index 0d840fe..3784a7d 100644 --- a/source/hslider.h +++ b/source/hslider.h @@ -29,7 +29,7 @@ public: virtual void button_release(int, int, unsigned); virtual void pointer_motion(int, int); private: - virtual void on_geometry_change(); + virtual void on_size_change(); virtual void on_style_change(); }; diff --git a/source/panel.cpp b/source/panel.cpp index 11c19f3..c97cd6d 100644 --- a/source/panel.cpp +++ b/source/panel.cpp @@ -176,7 +176,7 @@ int Panel::compute_delta(int pos, int dim, int origin_pos, int origin_dim, int n return 0; } -void Panel::on_geometry_change() +void Panel::on_size_change() { if(layout) layout->update(); diff --git a/source/panel.h b/source/panel.h index 8881f8c..9d969ff 100644 --- a/source/panel.h +++ b/source/panel.h @@ -95,7 +95,7 @@ protected: Widget *find_next_child(int, int, int, int, int) const; static int compute_delta(int, int, int, int, int); - virtual void on_geometry_change(); + virtual void on_size_change(); virtual void on_child_added(Widget &); virtual void on_child_removed(Widget &); }; diff --git a/source/root.cpp b/source/root.cpp index a76da5b..7134774 100644 --- a/source/root.cpp +++ b/source/root.cpp @@ -297,9 +297,9 @@ void Root::update_camera() camera.set_orthographic(geom.w, geom.h); } -void Root::on_geometry_change() +void Root::on_size_change() { - Panel::on_geometry_change(); + Panel::on_size_change(); update_camera(); } diff --git a/source/root.h b/source/root.h index 5de3626..73ca276 100644 --- a/source/root.h +++ b/source/root.h @@ -79,7 +79,7 @@ private: void get_touch(unsigned, int &, int &); void update_camera(); - virtual void on_geometry_change(); + virtual void on_size_change(); virtual void on_child_added(Widget &); }; diff --git a/source/vslider.cpp b/source/vslider.cpp index 6bc1553..cb345bb 100644 --- a/source/vslider.cpp +++ b/source/vslider.cpp @@ -62,7 +62,7 @@ void VSlider::pointer_motion(int, int y) drag(y); } -void VSlider::on_geometry_change() +void VSlider::on_size_change() { drag_area_size = geom.h-total_margin; } @@ -80,7 +80,7 @@ void VSlider::on_style_change() total_margin = margin.bottom+margin.top; } - on_geometry_change(); + on_size_change(); } } // namespace GLtk diff --git a/source/vslider.h b/source/vslider.h index 6086d3f..96fd03f 100644 --- a/source/vslider.h +++ b/source/vslider.h @@ -25,7 +25,7 @@ public: virtual void button_release(int, int, unsigned); virtual void pointer_motion(int, int); private: - virtual void on_geometry_change(); + virtual void on_size_change(); virtual void on_style_change(); }; diff --git a/source/widget.cpp b/source/widget.cpp index 246c8c1..d6d5755 100644 --- a/source/widget.cpp +++ b/source/widget.cpp @@ -72,8 +72,7 @@ void Widget::set_geometry(const Geometry &g) geom = g; if(size_changed) { - // TODO maybe rename this to on_size_change - on_geometry_change(); + on_size_change(); rebuild(); } } diff --git a/source/widget.h b/source/widget.h index 94ee7f6..2e8ef7a 100644 --- a/source/widget.h +++ b/source/widget.h @@ -159,9 +159,12 @@ public: virtual bool navigate(Navigation) { return false; } virtual void animate(const Time::TimeDelta &) { } protected: - virtual void on_geometry_change() { } + virtual void on_size_change() { on_geometry_change(); } virtual void on_style_change() { } virtual void on_reparent() { } + + // Deprecated + virtual void on_geometry_change() { } }; } // namespace GLtk