Move the dragScroll enumeration into the fc namespace

This commit is contained in:
Markus Gans 2017-06-18 19:36:22 +02:00
parent 28cdbc77af
commit ddb1c884e4
4 changed files with 58 additions and 54 deletions

View File

@ -1,3 +1,6 @@
2017-06-18 Markus Gans <guru.mail@muenster.de>
* Move the dragScroll enumeration into the fc namespace
2017-06-11 Markus Gans <guru.mail@muenster.de> 2017-06-11 Markus Gans <guru.mail@muenster.de>
* New method FObject::isWidget() * New method FObject::isWidget()
* Non-widget objects inherit from FObjects will no longer * Non-widget objects inherit from FObjects will no longer

View File

@ -908,6 +908,16 @@ class fc
FocusDefiniteWidget = 0x03 // event default FocusDefiniteWidget = 0x03 // event default
}; };
// Drag scrolling mode
enum dragScroll
{
noScroll = 0,
scrollUp = 1,
scrollDown = 2,
scrollUpSelect = 3,
scrollDownSelect = 4
};
// Scroll bar visibility mode // Scroll bar visibility mode
enum scrollBarMode enum scrollBarMode
{ {

View File

@ -78,7 +78,7 @@ FListBox::FListBox (FWidget* parent)
, inc_search() , inc_search()
, multi_select(false) , multi_select(false)
, mouse_select(false) , mouse_select(false)
, drag_scroll(FListBox::noScroll) , drag_scroll(fc::noScroll)
, scroll_timer(false) , scroll_timer(false)
, scroll_repeat(100) , scroll_repeat(100)
, scroll_distance(1) , scroll_distance(1)
@ -762,10 +762,10 @@ void FListBox::onMouseDown (FMouseEvent* ev)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListBox::onMouseUp (FMouseEvent* ev) void FListBox::onMouseUp (FMouseEvent* ev)
{ {
if ( drag_scroll != FListBox::noScroll ) if ( drag_scroll != fc::noScroll )
{ {
delOwnTimer(); delOwnTimer();
drag_scroll = FListBox::noScroll; drag_scroll = fc::noScroll;
scroll_distance = 1; scroll_distance = 1;
scroll_timer = false; scroll_timer = false;
} }
@ -865,7 +865,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
if ( mouse_y < 2 ) if ( mouse_y < 2 )
{ {
// drag up // drag up
if ( drag_scroll != FListBox::noScroll if ( drag_scroll != fc::noScroll
&& scroll_distance < getClientHeight() ) && scroll_distance < getClientHeight() )
scroll_distance++; scroll_distance++;
@ -875,21 +875,21 @@ void FListBox::onMouseMove (FMouseEvent* ev)
addTimer(scroll_repeat); addTimer(scroll_repeat);
if ( ev->getButton() == fc::RightButton ) if ( ev->getButton() == fc::RightButton )
drag_scroll = FListBox::scrollUpSelect; drag_scroll = fc::scrollUpSelect;
else else
drag_scroll = FListBox::scrollUp; drag_scroll = fc::scrollUp;
} }
if ( current == 1 ) if ( current == 1 )
{ {
delOwnTimer(); delOwnTimer();
drag_scroll = FListBox::noScroll; drag_scroll = fc::noScroll;
} }
} }
else if ( mouse_y >= getHeight() ) else if ( mouse_y >= getHeight() )
{ {
// drag down // drag down
if ( drag_scroll != FListBox::noScroll if ( drag_scroll != fc::noScroll
&& scroll_distance < getClientHeight() ) && scroll_distance < getClientHeight() )
scroll_distance++; scroll_distance++;
@ -899,15 +899,15 @@ void FListBox::onMouseMove (FMouseEvent* ev)
addTimer(scroll_repeat); addTimer(scroll_repeat);
if ( ev->getButton() == fc::RightButton ) if ( ev->getButton() == fc::RightButton )
drag_scroll = FListBox::scrollDownSelect; drag_scroll = fc::scrollDownSelect;
else else
drag_scroll = FListBox::scrollDown; drag_scroll = fc::scrollDown;
} }
if ( current == int(getCount()) ) if ( current == int(getCount()) )
{ {
delOwnTimer(); delOwnTimer();
drag_scroll = FListBox::noScroll; drag_scroll = fc::noScroll;
} }
} }
else else
@ -916,7 +916,7 @@ void FListBox::onMouseMove (FMouseEvent* ev)
delOwnTimer(); delOwnTimer();
scroll_timer = false; scroll_timer = false;
scroll_distance = 1; scroll_distance = 1;
drag_scroll = FListBox::noScroll; drag_scroll = fc::noScroll;
} }
} }
@ -951,14 +951,14 @@ void FListBox::onTimer (FTimerEvent*)
switch ( int(drag_scroll) ) switch ( int(drag_scroll) )
{ {
case FListBox::noScroll: case fc::noScroll:
return; return;
case FListBox::scrollUp: case fc::scrollUp:
case FListBox::scrollUpSelect: case fc::scrollUpSelect:
if ( current_before == 1) if ( current_before == 1)
{ {
drag_scroll = FListBox::noScroll; drag_scroll = fc::noScroll;
return; return;
} }
@ -974,11 +974,11 @@ void FListBox::onTimer (FTimerEvent*)
yoffset=0; yoffset=0;
break; break;
case FListBox::scrollDown: case fc::scrollDown:
case FListBox::scrollDownSelect: case fc::scrollDownSelect:
if ( current_before == element_count ) if ( current_before == element_count )
{ {
drag_scroll = FListBox::noScroll; drag_scroll = fc::noScroll;
return; return;
} }
@ -1000,8 +1000,8 @@ void FListBox::onTimer (FTimerEvent*)
} }
// handle multiple selections // handle multiple selections
if ( drag_scroll == FListBox::scrollUpSelect if ( drag_scroll == fc::scrollUpSelect
|| drag_scroll == FListBox::scrollDownSelect ) || drag_scroll == fc::scrollDownSelect )
{ {
if ( isMultiSelection() && current_before != current ) if ( isMultiSelection() && current_before != current )
{ {
@ -1062,12 +1062,12 @@ void FListBox::onWheel (FWheelEvent* ev)
wheel = ev->getWheel(); wheel = ev->getWheel();
if ( drag_scroll != FListBox::noScroll ) if ( drag_scroll != fc::noScroll )
{ {
delOwnTimer(); delOwnTimer();
scroll_timer = false; scroll_timer = false;
scroll_distance = 1; scroll_distance = 1;
drag_scroll = FListBox::noScroll; drag_scroll = fc::noScroll;
} }
switch ( wheel ) switch ( wheel )

View File

@ -196,15 +196,6 @@ class FListBox : public FWidget
private: private:
// Enumeration // Enumeration
enum dragScroll
{
noScroll = 0,
scrollUp = 1,
scrollDown = 2,
scrollUpSelect = 3,
scrollDownSelect = 4
};
enum convert_type enum convert_type
{ {
no_convert = 0, no_convert = 0,
@ -239,27 +230,27 @@ class FListBox : public FWidget
, int index ); , int index );
// Data Members // Data Members
listBoxItems data; listBoxItems data;
FWidget::data_ptr source_container; FWidget::data_ptr source_container;
convert_type conv_type; convert_type conv_type;
FScrollbar* vbar; FScrollbar* vbar;
FScrollbar* hbar; FScrollbar* hbar;
FString text; FString text;
FString inc_search; FString inc_search;
bool multi_select; bool multi_select;
bool mouse_select; bool mouse_select;
dragScroll drag_scroll; fc::dragScroll drag_scroll;
bool scroll_timer; bool scroll_timer;
int scroll_repeat; int scroll_repeat;
int scroll_distance; int scroll_distance;
int current; int current;
int last_current; int last_current;
int secect_from_item; int secect_from_item;
int xoffset; int xoffset;
int yoffset; int yoffset;
int last_yoffset; int last_yoffset;
int nf_offset; int nf_offset;
int max_line_width; int max_line_width;
}; };
#pragma pack(pop) #pragma pack(pop)
@ -282,7 +273,7 @@ inline FListBox::FListBox ( Iterator first
, inc_search() , inc_search()
, multi_select(false) , multi_select(false)
, mouse_select(false) , mouse_select(false)
, drag_scroll(FListBox::noScroll) , drag_scroll(fc::noScroll)
, scroll_timer(false) , scroll_timer(false)
, scroll_repeat(100) , scroll_repeat(100)
, scroll_distance(1) , scroll_distance(1)
@ -320,7 +311,7 @@ inline FListBox::FListBox ( Container container
, inc_search() , inc_search()
, multi_select(false) , multi_select(false)
, mouse_select(false) , mouse_select(false)
, drag_scroll(FListBox::noScroll) , drag_scroll(fc::noScroll)
, scroll_timer(false) , scroll_timer(false)
, scroll_repeat(100) , scroll_repeat(100)
, scroll_distance(1) , scroll_distance(1)