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>
* New method FObject::isWidget()
* Non-widget objects inherit from FObjects will no longer

View File

@ -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
{

View File

@ -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 )

View File

@ -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)