diff options
| author | Matthias Melcher <github@matthiasm.com> | 2023-02-02 20:54:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-02 20:54:19 +0100 |
| commit | 1aa6c4fed823e74ded911a134065e2619ad53bf1 (patch) | |
| tree | 239e65b0af1a1a39012b4187894274e860350235 /src/Fl_Browser_.cxx | |
| parent | 59d3b2e9fd10bdf14592e82ced422346ecd7204e (diff) | |
Fix position() methods that shadow Fl_Widget::position()
* `FL_DEPRECATED` macro to mark `position()` method that shadow `Fl_Widget::position()` #69 (#666)
Diffstat (limited to 'src/Fl_Browser_.cxx')
| -rw-r--r-- | src/Fl_Browser_.cxx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/Fl_Browser_.cxx b/src/Fl_Browser_.cxx index 29d3fada9..d2dcbc39e 100644 --- a/src/Fl_Browser_.cxx +++ b/src/Fl_Browser_.cxx @@ -49,7 +49,7 @@ */ static void scrollbar_callback(Fl_Widget* s, void*) { - ((Fl_Browser_*)(s->parent()))->position(int(((Fl_Scrollbar*)s)->value())); + ((Fl_Browser_*)(s->parent()))->vposition(int(((Fl_Scrollbar*)s)->value())); } static void hscrollbar_callback(Fl_Widget* s, void*) { @@ -181,7 +181,7 @@ void Fl_Browser_::update_top() { } } -// Change position(), top() will update when update_top() is called +// Change vposition(), top() will update when update_top() is called // (probably by draw() or handle()): /** Sets the vertical scroll position of the list to pixel position \p pos. @@ -189,9 +189,9 @@ void Fl_Browser_::update_top() { of the screen. Example: A position of '3' scrolls the top three pixels of the list off the top edge of the screen. \param[in] pos The vertical position (in pixels) to scroll the browser to. - \see position(), hposition() + \see vposition(), hposition() */ -void Fl_Browser_::position(int pos) { +void Fl_Browser_::vposition(int pos) { if (pos < 0) pos = 0; if (pos == position_) return; position_ = pos; @@ -204,7 +204,7 @@ void Fl_Browser_::position(int pos) { of the screen. Example: A position of '18' scrolls the left 18 pixels of the list off the left edge of the screen. \param[in] pos The horizontal position (in pixels) to scroll the browser to. - \see position(), hposition() + \see vposition(), hposition() */ void Fl_Browser_::hposition(int pos) { if (pos < 0) pos = 0; @@ -244,7 +244,7 @@ void Fl_Browser_::display(void* item) { // First special case - want to display first item in the list? update_top(); - if (item == item_first()) {position(0); return;} + if (item == item_first()) { vposition(0); return; } int X, Y, W, H, Yp; bbox(X, Y, W, H); void* l = top_; @@ -252,11 +252,11 @@ void Fl_Browser_::display(void* item) { int h1; // 2nd special case - want to display item already displayed at top of browser? - if (l == item) {position(real_position_+Y); return;} // scroll up a bit + if (l == item) { vposition(real_position_+Y); return; } // scroll up a bit // 3rd special case - want to display item just above top of browser? void* lp = item_prev(l); - if (lp == item) {position(real_position_+Y-item_quick_height(lp)); return;} + if (lp == item) { vposition(real_position_+Y-item_quick_height(lp)); return; } #ifdef DISPLAY_SEARCH_BOTH_WAYS_AT_ONCE // search for item. We search both up and down the list at the same time, @@ -268,9 +268,9 @@ void Fl_Browser_::display(void* item) { if (l == item) { if (Y <= H) { // it is visible or right at bottom Y = Y+h1-H; // find where bottom edge is - if (Y > 0) position(real_position_+Y); // scroll down a bit + if (Y > 0) vposition(real_position_+Y); // scroll down a bit } else { - position(real_position_+Y-(H-h1)/2); // center it + vposition(real_position_+Y-(H-h1)/2); // center it } return; } @@ -281,8 +281,8 @@ void Fl_Browser_::display(void* item) { h1 = item_quick_height(lp); Yp -= h1; if (lp == item) { - if ((Yp + h1) >= 0) position(real_position_+Yp); - else position(real_position_+Yp-(H-h1)/2); + if ((Yp + h1) >= 0) vposition(real_position_+Yp); + else vposition(real_position_+Yp-(H-h1)/2); return; } lp = item_prev(lp); @@ -871,12 +871,12 @@ J1: if (my < Y && my < py) { int p = real_position_+my-Y; if (p<0) p = 0; - position(p); + vposition(p); } else if (my > (Y+H) && my > py) { int p = real_position_+my-(Y+H); int hh = full_height()-H; if (p > hh) p = hh; if (p<0) p = 0; - position(p); + vposition(p); } if (type() == FL_NORMAL_BROWSER || !top_) ; |
