From ddb1c884e4db0845191b9858370d57b059422e77 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sun, 18 Jun 2017 19:36:22 +0200 Subject: [PATCH] Move the dragScroll enumeration into the fc namespace --- ChangeLog | 3 +++ src/fc.h | 10 +++++++++ src/flistbox.cpp | 46 ++++++++++++++++++++--------------------- src/flistbox.h | 53 ++++++++++++++++++++---------------------------- 4 files changed, 58 insertions(+), 54 deletions(-) diff --git a/ChangeLog b/ChangeLog index 92b31674..231f2570 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2017-06-18 Markus Gans + * Move the dragScroll enumeration into the fc namespace + 2017-06-11 Markus Gans * New method FObject::isWidget() * Non-widget objects inherit from FObjects will no longer diff --git a/src/fc.h b/src/fc.h index 3637337b..9006287d 100644 --- a/src/fc.h +++ b/src/fc.h @@ -908,6 +908,16 @@ class fc FocusDefiniteWidget = 0x03 // event default }; + // Drag scrolling mode + enum dragScroll + { + noScroll = 0, + scrollUp = 1, + scrollDown = 2, + scrollUpSelect = 3, + scrollDownSelect = 4 + }; + // Scroll bar visibility mode enum scrollBarMode { diff --git a/src/flistbox.cpp b/src/flistbox.cpp index 5c8b9218..0b2ddeea 100644 --- a/src/flistbox.cpp +++ b/src/flistbox.cpp @@ -78,7 +78,7 @@ FListBox::FListBox (FWidget* parent) , inc_search() , multi_select(false) , mouse_select(false) - , drag_scroll(FListBox::noScroll) + , drag_scroll(fc::noScroll) , scroll_timer(false) , scroll_repeat(100) , scroll_distance(1) @@ -762,10 +762,10 @@ void FListBox::onMouseDown (FMouseEvent* ev) //---------------------------------------------------------------------- void FListBox::onMouseUp (FMouseEvent* ev) { - if ( drag_scroll != FListBox::noScroll ) + if ( drag_scroll != fc::noScroll ) { delOwnTimer(); - drag_scroll = FListBox::noScroll; + drag_scroll = fc::noScroll; scroll_distance = 1; scroll_timer = false; } @@ -865,7 +865,7 @@ void FListBox::onMouseMove (FMouseEvent* ev) if ( mouse_y < 2 ) { // drag up - if ( drag_scroll != FListBox::noScroll + if ( drag_scroll != fc::noScroll && scroll_distance < getClientHeight() ) scroll_distance++; @@ -875,21 +875,21 @@ void FListBox::onMouseMove (FMouseEvent* ev) addTimer(scroll_repeat); if ( ev->getButton() == fc::RightButton ) - drag_scroll = FListBox::scrollUpSelect; + drag_scroll = fc::scrollUpSelect; else - drag_scroll = FListBox::scrollUp; + drag_scroll = fc::scrollUp; } if ( current == 1 ) { delOwnTimer(); - drag_scroll = FListBox::noScroll; + drag_scroll = fc::noScroll; } } else if ( mouse_y >= getHeight() ) { // drag down - if ( drag_scroll != FListBox::noScroll + if ( drag_scroll != fc::noScroll && scroll_distance < getClientHeight() ) scroll_distance++; @@ -899,15 +899,15 @@ void FListBox::onMouseMove (FMouseEvent* ev) addTimer(scroll_repeat); if ( ev->getButton() == fc::RightButton ) - drag_scroll = FListBox::scrollDownSelect; + drag_scroll = fc::scrollDownSelect; else - drag_scroll = FListBox::scrollDown; + drag_scroll = fc::scrollDown; } if ( current == int(getCount()) ) { delOwnTimer(); - drag_scroll = FListBox::noScroll; + drag_scroll = fc::noScroll; } } else @@ -916,7 +916,7 @@ void FListBox::onMouseMove (FMouseEvent* ev) delOwnTimer(); scroll_timer = false; scroll_distance = 1; - drag_scroll = FListBox::noScroll; + drag_scroll = fc::noScroll; } } @@ -951,14 +951,14 @@ void FListBox::onTimer (FTimerEvent*) switch ( int(drag_scroll) ) { - case FListBox::noScroll: + case fc::noScroll: return; - case FListBox::scrollUp: - case FListBox::scrollUpSelect: + case fc::scrollUp: + case fc::scrollUpSelect: if ( current_before == 1) { - drag_scroll = FListBox::noScroll; + drag_scroll = fc::noScroll; return; } @@ -974,11 +974,11 @@ void FListBox::onTimer (FTimerEvent*) yoffset=0; break; - case FListBox::scrollDown: - case FListBox::scrollDownSelect: + case fc::scrollDown: + case fc::scrollDownSelect: if ( current_before == element_count ) { - drag_scroll = FListBox::noScroll; + drag_scroll = fc::noScroll; return; } @@ -1000,8 +1000,8 @@ void FListBox::onTimer (FTimerEvent*) } // handle multiple selections - if ( drag_scroll == FListBox::scrollUpSelect - || drag_scroll == FListBox::scrollDownSelect ) + if ( drag_scroll == fc::scrollUpSelect + || drag_scroll == fc::scrollDownSelect ) { if ( isMultiSelection() && current_before != current ) { @@ -1062,12 +1062,12 @@ void FListBox::onWheel (FWheelEvent* ev) wheel = ev->getWheel(); - if ( drag_scroll != FListBox::noScroll ) + if ( drag_scroll != fc::noScroll ) { delOwnTimer(); scroll_timer = false; scroll_distance = 1; - drag_scroll = FListBox::noScroll; + drag_scroll = fc::noScroll; } switch ( wheel ) diff --git a/src/flistbox.h b/src/flistbox.h index f55e4438..78a45ae3 100644 --- a/src/flistbox.h +++ b/src/flistbox.h @@ -196,15 +196,6 @@ class FListBox : public FWidget private: // Enumeration - enum dragScroll - { - noScroll = 0, - scrollUp = 1, - scrollDown = 2, - scrollUpSelect = 3, - scrollDownSelect = 4 - }; - enum convert_type { no_convert = 0, @@ -239,27 +230,27 @@ class FListBox : public FWidget , int index ); // Data Members - listBoxItems data; + listBoxItems data; FWidget::data_ptr source_container; - convert_type conv_type; - FScrollbar* vbar; - FScrollbar* hbar; - FString text; - FString inc_search; - bool multi_select; - bool mouse_select; - dragScroll drag_scroll; - bool scroll_timer; - int scroll_repeat; - int scroll_distance; - int current; - int last_current; - int secect_from_item; - int xoffset; - int yoffset; - int last_yoffset; - int nf_offset; - int max_line_width; + convert_type conv_type; + FScrollbar* vbar; + FScrollbar* hbar; + FString text; + FString inc_search; + bool multi_select; + bool mouse_select; + fc::dragScroll drag_scroll; + bool scroll_timer; + int scroll_repeat; + int scroll_distance; + int current; + int last_current; + int secect_from_item; + int xoffset; + int yoffset; + int last_yoffset; + int nf_offset; + int max_line_width; }; #pragma pack(pop) @@ -282,7 +273,7 @@ inline FListBox::FListBox ( Iterator first , inc_search() , multi_select(false) , mouse_select(false) - , drag_scroll(FListBox::noScroll) + , drag_scroll(fc::noScroll) , scroll_timer(false) , scroll_repeat(100) , scroll_distance(1) @@ -320,7 +311,7 @@ inline FListBox::FListBox ( Container container , inc_search() , multi_select(false) , mouse_select(false) - , drag_scroll(FListBox::noScroll) + , drag_scroll(fc::noScroll) , scroll_timer(false) , scroll_repeat(100) , scroll_distance(1)