Moving widget flags into the class fc

This commit is contained in:
Markus Gans 2016-01-24 14:53:09 +01:00
parent e35340114b
commit 56e5847d41
24 changed files with 144 additions and 138 deletions

View File

@ -1,3 +1,6 @@
2016-01-24 Markus Gans <guru.mail@muenster.de>
* Moving widget flags into the class fc
2016-01-17 Markus Gans <guru.mail@muenster.de>
* Moving events into the class fc
* Avoid height and width underflow in adjustSize()

View File

@ -1379,7 +1379,7 @@ bool FApplication::sendEvent(FObject* receiver, FEvent* event)
window = FWindow::getWindowWidget(widget);
// block events for widgets in non modal windows
if ( window && (window->getFlags() & MODAL) == 0 )
if ( window && (window->getFlags() & fc::modal) == 0 )
{
switch ( event->type() )
{

View File

@ -64,10 +64,10 @@ void FButton::init()
setBackgroundColor (wc.button_active_bg);
if ( hasFocus() )
flags = FOCUS;
flags = fc::focus;
if ( isEnabled() )
flags |= ACTIVE;
flags |= fc::active;
}
//----------------------------------------------------------------------
@ -151,12 +151,12 @@ void FButton::draw()
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(ButtonText);
is_ActiveFocus = (flags & (ACTIVE+FOCUS)) == (ACTIVE+FOCUS);
is_Active = ((flags & ACTIVE) != 0);
is_Focus = ((flags & FOCUS) != 0);
is_ActiveFocus = (flags & (fc::active+fc::focus)) == (fc::active+fc::focus);
is_Active = ((flags & fc::active) != 0);
is_Focus = ((flags & fc::focus) != 0);
is_Flat = isFlat();
is_NonFlatShadow = ((flags & (SHADOW+FLAT)) == SHADOW);
is_NoUnderline = ((flags & NO_UNDERLINE) != 0);
is_NonFlatShadow = ((flags & (fc::shadow+fc::flat)) == fc::shadow);
is_NoUnderline = ((flags & fc::no_underline) != 0);
setUpdateVTerm(false);
if ( isMonochron() )
@ -483,9 +483,9 @@ void FButton::hide()
bool FButton::setNoUnderline (bool on)
{
if ( on )
flags |= NO_UNDERLINE;
flags |= fc::no_underline;
else
flags &= ~NO_UNDERLINE;
flags &= ~fc::no_underline;
return on;
}
@ -496,12 +496,12 @@ bool FButton::setEnable (bool on)
if ( on )
{
flags |= ACTIVE;
flags |= fc::active;
setHotkeyAccelerator();
}
else
{
flags &= ~ACTIVE;
flags &= ~fc::active;
delAccelerator();
}
updateButtonColor();
@ -515,7 +515,7 @@ bool FButton::setFocus (bool on)
if ( on )
{
flags |= FOCUS;
flags |= fc::focus;
if ( isEnabled() )
{
@ -530,7 +530,7 @@ bool FButton::setFocus (bool on)
}
else
{
flags &= ~FOCUS;
flags &= ~fc::focus;
if ( isEnabled() && statusBar() )
statusBar()->clearMessage();
@ -543,9 +543,9 @@ bool FButton::setFocus (bool on)
bool FButton::setFlat (bool on)
{
if ( on )
flags |= FLAT;
flags |= fc::flat;
else
flags &= ~FLAT;
flags &= ~fc::flat;
return on;
}
@ -555,9 +555,9 @@ bool FButton::setShadow (bool on)
if ( on
&& (Encoding != fc::VT100 || isTeraTerm() )
&& Encoding != fc::ASCII )
flags |= SHADOW;
flags |= fc::shadow;
else
flags &= ~SHADOW;
flags &= ~fc::shadow;
return on;
}

View File

@ -161,7 +161,7 @@ inline bool FButton::unsetFlat()
//----------------------------------------------------------------------
inline bool FButton::isFlat() const
{ return ((flags & FLAT) != 0); }
{ return ((flags & fc::flat) != 0); }
//----------------------------------------------------------------------
inline bool FButton::setShadow()
@ -173,7 +173,7 @@ inline bool FButton::unsetShadow()
//----------------------------------------------------------------------
inline bool FButton::hasShadow() const
{ return ((flags & SHADOW) != 0); }
{ return ((flags & fc::shadow) != 0); }
//----------------------------------------------------------------------
inline bool FButton::setDown()

View File

@ -60,7 +60,7 @@ void FButtonGroup::init()
right_padding = 1;
if ( isEnabled() )
flags |= ACTIVE;
flags |= fc::active;
foregroundColor = wc.label_fg;
backgroundColor = wc.label_bg;
@ -212,8 +212,8 @@ void FButtonGroup::drawLabel()
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(LabelText);
isActive = ((flags & ACTIVE) != 0);
isNoUnderline = ((flags & NO_UNDERLINE) != 0);
isActive = ((flags & fc::active) != 0);
isNoUnderline = ((flags & fc::no_underline) != 0);
// find hotkey position in string
// + generate a new string without the '&'-sign
@ -523,12 +523,12 @@ bool FButtonGroup::setEnable (bool on)
if ( on )
{
flags |= ACTIVE;
flags |= fc::active;
setHotkeyAccelerator();
}
else
{
flags &= ~ACTIVE;
flags &= ~fc::active;
delAccelerator();
}
return on;

View File

@ -63,7 +63,7 @@ FDialog::~FDialog() // destructor
while ( iter != end )
{
putArea ((*iter)->getGlobalPos(), (*iter)->getVWin());
if ( ! maximized && ((*iter)->getFlags() & SHADOW) != 0 )
if ( ! maximized && ((*iter)->getFlags() & fc::shadow) != 0 )
static_cast<FDialog*>(*iter)->drawDialogShadow();
++iter;
}
@ -113,9 +113,9 @@ void FDialog::init()
backgroundColor = wc.dialog_bg;
if ( hasFocus() )
flags |= FOCUS;
flags |= fc::focus;
if ( isEnabled() )
flags |= ACTIVE;
flags |= fc::active;
FWidget* old_focus = FWidget::getFocusWidget();
if ( old_focus )
@ -152,7 +152,7 @@ void FDialog::drawBorder()
// border right⎹
print (fc::NF_rev_border_line_right);
}
if ( (flags & SHADOW) == 0 )
if ( (flags & fc::shadow) == 0 )
{
setColor (fg, backgroundColor);
gotoxy (x1, y2);
@ -262,12 +262,12 @@ void FDialog::done(int result)
//----------------------------------------------------------------------
void FDialog::drawDialogShadow()
{
if ((flags & TRANS_SHADOW) != 0)
if ((flags & fc::trans_shadow) != 0)
{
// transparent shadow
drawShadow();
if ( isNewFont() && ((flags & SCROLLABLE) == 0) )
if ( isNewFont() && ((flags & fc::scrollable) == 0) )
{
FOptiAttr::char_data ch;
// left of the shadow ▀▀
@ -293,7 +293,7 @@ void FDialog::drawDialogShadow()
// left of the shadow ▀▀
gotoxy (xpos+xmin-1, ypos+ymin-1+height);
if ( isNewFont() && ((flags & SCROLLABLE) == 0) )
if ( isNewFont() && ((flags & fc::scrollable) == 0) )
{
setColor (wc.shadow_fg, ch.bg_color);
// high line ⎺
@ -359,10 +359,10 @@ void FDialog::draw()
drawBorder();
drawTitleBar();
if ( ! maximized && (flags & SHADOW) != 0 )
if ( ! maximized && (flags & fc::shadow) != 0 )
drawDialogShadow();
if ( (flags & RESIZEABLE) != 0 )
if ( (flags & fc::resizeable) != 0 )
{
if ( isMonochron() )
setReverse(false);
@ -635,7 +635,7 @@ void FDialog::onWindowRaised (FEvent*)
{
if ( *iter != this
&& ! maximized
&& ((*iter)->getFlags() & SHADOW) != 0 )
&& ((*iter)->getFlags() & fc::shadow) != 0 )
static_cast<FDialog*>(*iter)->drawDialogShadow();
++iter;
}
@ -657,7 +657,7 @@ void FDialog::onWindowLowered (FEvent*)
while ( iter != end )
{
putArea ((*iter)->getGlobalPos(), (*iter)->getVWin());
if ( ! maximized && ((*iter)->getFlags() & SHADOW) != 0 )
if ( ! maximized && ((*iter)->getFlags() & fc::shadow) != 0 )
static_cast<FDialog*>(*iter)->drawDialogShadow();
++iter;
}
@ -775,7 +775,7 @@ void FDialog::move (int x, int y)
restoreVTerm (old_x, old_y, width+rsw, height+bsh);
}
if ( ! maximized && (flags & SHADOW) != 0 )
if ( ! maximized && (flags & fc::shadow) != 0 )
drawDialogShadow();
// handle overlaid windows
@ -791,7 +791,7 @@ void FDialog::move (int x, int y)
if ( overlaid )
{
putArea ((*iter)->getGlobalPos(), (*iter)->getVWin());
if ( ! maximized && ((*iter)->getFlags() & SHADOW) != 0 )
if ( ! maximized && ((*iter)->getFlags() & fc::shadow) != 0 )
static_cast<FDialog*>(*iter)->drawDialogShadow();
}
if ( vwin == (*iter)->getVWin() )
@ -861,9 +861,9 @@ bool FDialog::setFocus (bool on)
FWidget::setFocus(on);
if ( on )
flags |= FOCUS;
flags |= fc::focus;
else
flags &= ~FOCUS;
flags &= ~fc::focus;
return on;
}
@ -875,12 +875,12 @@ bool FDialog::setModal (bool on)
if ( on )
{
flags |= MODAL;
flags |= fc::modal;
modal_dialogs++;
}
else
{
flags &= ~MODAL;
flags &= ~fc::modal;
modal_dialogs--;
}
return on;
@ -891,16 +891,16 @@ bool FDialog::setTransparentShadow (bool on)
{
if ( on )
{
flags |= SHADOW;
flags |= TRANS_SHADOW;
flags |= fc::shadow;
flags |= fc::trans_shadow;
shadow.setPoint(2,1);
adjustWidgetSizeShadow = getGeometry() + getShadow();
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
}
else
{
flags &= ~SHADOW;
flags &= ~TRANS_SHADOW;
flags &= ~fc::shadow;
flags &= ~fc::trans_shadow;
shadow.setPoint(0,0);
adjustWidgetSizeShadow = getGeometry() + getShadow();
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
@ -917,16 +917,16 @@ bool FDialog::setShadow (bool on)
if ( on )
{
flags |= SHADOW;
flags &= ~TRANS_SHADOW;
flags |= fc::shadow;
flags &= ~fc::trans_shadow;
shadow.setPoint(1,1);
adjustWidgetSizeShadow = getGeometry() + getShadow();
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
}
else
{
flags &= ~SHADOW;
flags &= ~TRANS_SHADOW;
flags &= ~fc::shadow;
flags &= ~fc::trans_shadow;
shadow.setPoint(0,0);
adjustWidgetSizeShadow = getGeometry() + getShadow();
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
@ -939,9 +939,9 @@ bool FDialog::setShadow (bool on)
bool FDialog::setScrollable (bool on)
{
if ( on )
flags |= SCROLLABLE;
flags |= fc::scrollable;
else
flags &= ~SCROLLABLE;
flags &= ~fc::scrollable;
return on;
}
@ -949,9 +949,9 @@ bool FDialog::setScrollable (bool on)
bool FDialog::setResizeable (bool on)
{
if ( on )
flags |= RESIZEABLE;
flags |= fc::resizeable;
else
flags &= ~RESIZEABLE;
flags &= ~fc::resizeable;
return on;
}

View File

@ -151,7 +151,7 @@ inline bool FDialog::unsetModal()
//----------------------------------------------------------------------
inline bool FDialog::isModal()
{ return ((flags & MODAL) != 0); }
{ return ((flags & fc::modal) != 0); }
//----------------------------------------------------------------------
inline bool FDialog::setScrollable()
@ -163,7 +163,7 @@ inline bool FDialog::unsetScrollable()
//----------------------------------------------------------------------
inline bool FDialog::isScrollable()
{ return ((flags & SCROLLABLE) != 0); }
{ return ((flags & fc::scrollable) != 0); }
//----------------------------------------------------------------------
inline bool FDialog::setResizeable()
@ -175,7 +175,7 @@ inline bool FDialog::unsetResizeable()
//----------------------------------------------------------------------
inline bool FDialog::isResizeable()
{ return ((flags & RESIZEABLE) != 0); }
{ return ((flags & fc::resizeable) != 0); }
//----------------------------------------------------------------------
inline bool FDialog::isMaximized() const
@ -191,7 +191,7 @@ inline bool FDialog::unsetTransparentShadow()
//----------------------------------------------------------------------
inline bool FDialog::hasTransparentShadow()
{ return ((flags & TRANS_SHADOW) != 0); }
{ return ((flags & fc::trans_shadow) != 0); }
//----------------------------------------------------------------------
inline bool FDialog::setShadow()
@ -203,7 +203,7 @@ inline bool FDialog::unsetShadow()
//----------------------------------------------------------------------
inline bool FDialog::hasShadow()
{ return ((flags & SHADOW) != 0); }
{ return ((flags & fc::shadow) != 0); }
//----------------------------------------------------------------------
inline FString FDialog::getText() const

View File

@ -48,6 +48,20 @@ class fc
Timer_Event // timer event occur
};
// properties of a widget
enum widget_flags
{
shadow = 0x00000001,
trans_shadow = 0x00000002,
active = 0x00000004,
focus = 0x00000008,
scrollable = 0x00000010,
resizeable = 0x00000020,
modal = 0x00000040,
flat = 0x00000080,
no_underline = 0x00000100
};
// internal character encoding
enum encoding
{

View File

@ -56,7 +56,7 @@ FLabel::~FLabel() // destructor
void FLabel::init()
{
if ( isEnabled() )
flags |= ACTIVE;
flags |= fc::active;
unsetFocusable();
@ -164,8 +164,8 @@ void FLabel::printLine ( wchar_t*& line
int to_char;
bool isActive, isNoUnderline;
isActive = ((flags & ACTIVE) != 0);
isNoUnderline = ((flags & NO_UNDERLINE) != 0);
isActive = ((flags & fc::active) != 0);
isNoUnderline = ((flags & fc::no_underline) != 0);
for (int x=0; x < xoffset; x++)
print (' ');
@ -438,12 +438,12 @@ bool FLabel::setEnable (bool on)
if ( on )
{
flags |= ACTIVE;
flags |= fc::active;
setHotkeyAccelerator();
}
else
{
flags &= ~ACTIVE;
flags &= ~fc::active;
delAccelerator();
}
return on;

View File

@ -69,11 +69,11 @@ void FLineEdit::init()
setVisibleCursor();
if ( hasFocus() )
flags |= FOCUS;
flags |= fc::focus;
if ( isEnabled() )
{
flags |= ACTIVE;
flags |= fc::active;
if ( hasFocus() )
{
@ -108,7 +108,7 @@ void FLineEdit::draw()
drawInputField();
isFocus = ((flags & FOCUS) != 0);
isFocus = ((flags & fc::focus) != 0);
if ( isFocus && statusBar() )
{
FString msg = getStatusbarMessage();
@ -127,9 +127,9 @@ void FLineEdit::drawInputField()
bool isActiveFocus, isActive, isShadow;
int x;
FString show_text;
isActiveFocus = (flags & (ACTIVE+FOCUS)) == (ACTIVE+FOCUS);
isActive = ((flags & ACTIVE) != 0);
isShadow = ((flags & SHADOW) != 0 );
isActiveFocus = (flags & (fc::active+fc::focus)) == (fc::active+fc::focus);
isActive = ((flags & fc::active) != 0);
isShadow = ((flags & fc::shadow) != 0 );
setUpdateVTerm(false);
gotoxy (xpos+xmin-1, ypos+ymin-1);
@ -327,7 +327,7 @@ bool FLineEdit::setEnable (bool on)
if ( on )
{
flags |= ACTIVE;
flags |= fc::active;
if ( hasFocus() )
{
foregroundColor = wc.inputfield_active_focus_fg;
@ -341,7 +341,7 @@ bool FLineEdit::setEnable (bool on)
}
else
{
flags &= ~ACTIVE;
flags &= ~fc::active;
foregroundColor = wc.inputfield_inactive_fg;
backgroundColor = wc.inputfield_inactive_bg;
}
@ -355,7 +355,7 @@ bool FLineEdit::setFocus (bool on)
if ( on )
{
flags |= FOCUS;
flags |= fc::focus;
if ( isEnabled() )
{
@ -373,7 +373,7 @@ bool FLineEdit::setFocus (bool on)
}
else
{
flags &= ~FOCUS;
flags &= ~fc::focus;
if ( isEnabled() )
{
@ -392,9 +392,9 @@ bool FLineEdit::setShadow (bool on)
if ( on
&& (Encoding != fc::VT100 || isTeraTerm() )
&& Encoding != fc::ASCII )
flags |= SHADOW;
flags |= fc::shadow;
else
flags &= ~SHADOW;
flags &= ~fc::shadow;
return on;
}

View File

@ -150,7 +150,7 @@ inline bool FLineEdit::unsetShadow()
//----------------------------------------------------------------------
inline bool FLineEdit::hasShadow()
{ return ((flags & SHADOW) != 0); }
{ return ((flags & fc::shadow) != 0); }
//----------------------------------------------------------------------
inline FString FLineEdit::getText() const

View File

@ -91,9 +91,9 @@ FListBox::~FListBox() // destructor
void FListBox::init()
{
if ( hasFocus() )
flags = FOCUS;
flags = fc::focus;
if ( isEnabled() )
flags |= ACTIVE;
flags |= fc::active;
nf_offset = isNewFont() ? 1 : 0;
@ -164,7 +164,7 @@ void FListBox::draw()
drawList();
isFocus = ((flags & FOCUS) != 0);
isFocus = ((flags & fc::focus) != 0);
if ( isFocus && statusBar() )
{
@ -215,7 +215,7 @@ void FListBox::drawList()
if ( data.empty() || height < 4 || width < 5 )
return;
isFocus = ((flags & FOCUS) != 0);
isFocus = ((flags & fc::focus) != 0);
start = 0;
end = uInt(height-2);
inc_len = inc_search.getLength();
@ -604,9 +604,9 @@ bool FListBox::setEnable (bool on)
FWidget::setEnable(on);
if ( on )
flags |= ACTIVE;
flags |= fc::active;
else
flags &= ~ACTIVE;
flags &= ~fc::active;
return on;
}
@ -617,7 +617,7 @@ bool FListBox::setFocus (bool on)
if ( on )
{
flags |= FOCUS;
flags |= fc::focus;
if ( statusBar() )
{
@ -629,7 +629,7 @@ bool FListBox::setFocus (bool on)
}
else
{
flags &= ~FOCUS;
flags &= ~fc::focus;
if ( statusBar() )
statusBar()->clearMessage();
@ -641,9 +641,9 @@ bool FListBox::setFocus (bool on)
bool FListBox::setShadow (bool on)
{
if ( on )
flags |= SHADOW;
flags |= fc::shadow;
else
flags &= ~SHADOW;
flags &= ~fc::shadow;
return on;
}

View File

@ -277,7 +277,7 @@ inline bool FListBox::unsetShadow()
//----------------------------------------------------------------------
inline bool FListBox::hasShadow()
{ return ((flags & SHADOW) != 0); }
{ return ((flags & fc::shadow) != 0); }
//----------------------------------------------------------------------
inline FString& FListBox::getText()

View File

@ -557,7 +557,7 @@ void FMenu::draw()
drawItems();
if ( isMonochron() )
setReverse(false);
if ( (flags & SHADOW) != 0 )
if ( (flags & fc::shadow) != 0 )
drawMenuShadow();
setUpdateVTerm(true);
}
@ -654,7 +654,7 @@ void FMenu::drawItems()
bool is_checkable = (*iter)->checkable;
bool is_radio_btn = (*iter)->radio_button;
bool is_selected = (*iter)->isSelected();
bool is_noUnderline = (((*iter)->getFlags() & NO_UNDERLINE) != 0);
bool is_noUnderline = (((*iter)->getFlags() & fc::no_underline) != 0);
bool is_separator = (*iter)->isSeparator();
if ( is_separator )
@ -1442,16 +1442,16 @@ bool FMenu::setTransparentShadow (bool on)
{
if ( on )
{
flags |= SHADOW;
flags |= TRANS_SHADOW;
flags |= fc::shadow;
flags |= fc::trans_shadow;
shadow.setPoint(2,1);
adjustWidgetSizeShadow = getGeometry() + getShadow();
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();
}
else
{
flags &= ~SHADOW;
flags &= ~TRANS_SHADOW;
flags &= ~fc::shadow;
flags &= ~fc::trans_shadow;
shadow.setPoint(0,0);
adjustWidgetSizeShadow = getGeometry() + getShadow();
adjustWidgetSizeGlobalShadow = getGeometryGlobal() + getShadow();

View File

@ -224,7 +224,7 @@ inline bool FMenu::unsetTransparentShadow()
//----------------------------------------------------------------------
inline bool FMenu::hasTransparentShadow()
{ return ((flags & TRANS_SHADOW) != 0); }
{ return ((flags & fc::trans_shadow) != 0); }
//----------------------------------------------------------------------
inline void FMenu::setText (FString& txt)

View File

@ -318,7 +318,7 @@ void FMenuBar::drawItems()
startpos = x + 1;
is_active = (*iter)->isEnabled();
is_selected = (*iter)->isSelected();
is_noUnderline = (((*iter)->getFlags() & NO_UNDERLINE) != 0);
is_noUnderline = (((*iter)->getFlags() & fc::no_underline) != 0);
if ( is_active )
{

View File

@ -195,10 +195,10 @@ void FMenuItem::init (FWidget* parent)
}
}
if ( hasFocus() )
flags = FOCUS;
flags = fc::focus;
if ( isEnabled() )
flags |= ACTIVE;
flags |= fc::active;
}
//----------------------------------------------------------------------
@ -555,7 +555,7 @@ bool FMenuItem::setEnable (bool on)
if ( on )
{
flags |= ACTIVE;
flags |= fc::active;
if ( super && isMenuBar(super) )
{
@ -565,7 +565,7 @@ bool FMenuItem::setEnable (bool on)
}
else
{
flags &= ~ACTIVE;
flags &= ~fc::active;
if ( super && isMenuBar(super) )
super->delAccelerator (this);
@ -580,7 +580,7 @@ bool FMenuItem::setFocus (bool on)
if ( on )
{
flags |= FOCUS;
flags |= fc::focus;
if ( isEnabled() )
{
@ -623,7 +623,7 @@ bool FMenuItem::setFocus (bool on)
}
else
{
flags &= ~FOCUS;
flags &= ~fc::focus;
if ( isEnabled() && statusBar() )
statusBar()->clearMessage();

View File

@ -143,7 +143,7 @@ void FProgressbar::draw()
drawPercentage();
drawBar();
if ( (flags & SHADOW) != 0 )
if ( (flags & fc::shadow) != 0 )
drawShadow ();
setUpdateVTerm(true);
flush_out();
@ -231,9 +231,9 @@ bool FProgressbar::setEnable (bool on)
FWidget::setEnable(on);
if ( on )
flags |= ACTIVE;
flags |= fc::active;
else
flags &= ~ACTIVE;
flags &= ~fc::active;
return on;
}
@ -243,8 +243,8 @@ bool FProgressbar::setShadow (bool on)
if ( on
&& (Encoding != fc::VT100 || isTeraTerm() )
&& Encoding != fc::ASCII )
flags |= SHADOW;
flags |= fc::shadow;
else
flags &= ~SHADOW;
flags &= ~fc::shadow;
return on;
}

View File

@ -102,7 +102,7 @@ inline bool FProgressbar::unsetShadow()
//----------------------------------------------------------------------
inline bool FProgressbar::hasShadow()
{ return ((flags & SHADOW) != 0); }
{ return ((flags & fc::shadow) != 0); }
#endif // _FPROGRESSBAR_H

View File

@ -71,11 +71,11 @@ void FToggleButton::init()
setGeometry (1, 1, 4, 1, false); // initialize geometry values
if ( hasFocus() )
flags = FOCUS;
flags = fc::focus;
if ( isEnabled() )
{
flags |= ACTIVE;
flags |= fc::active;
if ( hasFocus() )
{
@ -152,7 +152,7 @@ void FToggleButton::setHotkeyAccelerator()
//----------------------------------------------------------------------
void FToggleButton::draw()
{
bool isFocus = ((flags & FOCUS) != 0);
bool isFocus = ((flags & fc::focus) != 0);
if ( isFocus && statusBar() )
{
FString msg = getStatusbarMessage();
@ -202,8 +202,8 @@ void FToggleButton::drawLabel()
txt = text;
src = const_cast<wchar_t*>(txt.wc_str());
dest = const_cast<wchar_t*>(LabelText);
isActive = ((flags & ACTIVE) != 0);
isNoUnderline = ((flags & NO_UNDERLINE) != 0);
isActive = ((flags & fc::active) != 0);
isNoUnderline = ((flags & fc::no_underline) != 0);
// find hotkey position in string
// + generate a new string without the '&'-sign
@ -378,9 +378,9 @@ void FToggleButton::setGeometry (int x, int y, int w, int h, bool adjust)
bool FToggleButton::setNoUnderline (bool on)
{
if ( on )
flags |= NO_UNDERLINE;
flags |= fc::no_underline;
else
flags &= ~NO_UNDERLINE;
flags &= ~fc::no_underline;
return on;
}
@ -391,7 +391,7 @@ bool FToggleButton::setEnable (bool on)
if ( on )
{
flags |= ACTIVE;
flags |= fc::active;
setHotkeyAccelerator();
if ( hasFocus() )
{
@ -406,7 +406,7 @@ bool FToggleButton::setEnable (bool on)
}
else
{
flags &= ~ACTIVE;
flags &= ~fc::active;
delAccelerator();
foregroundColor = wc.toggle_button_inactive_fg;
backgroundColor = wc.toggle_button_inactive_bg;
@ -421,7 +421,7 @@ bool FToggleButton::setFocus (bool on)
if ( on )
{
flags |= FOCUS;
flags |= fc::focus;
if ( isEnabled() )
{
@ -446,7 +446,7 @@ bool FToggleButton::setFocus (bool on)
}
else
{
flags &= ~FOCUS;
flags &= ~fc::focus;
if ( isEnabled() )
{

View File

@ -944,7 +944,7 @@ bool FWidget::close()
else
{
hide();
if ( (flags & MODAL) == 0 )
if ( (flags & fc::modal) == 0 )
close_widget->push_back(this);
}
return true;
@ -1817,7 +1817,7 @@ void FWidget::drawShadow()
{
FOptiAttr::char_data ch;
int x1, x2, y1, y2;
bool trans_shadow = ((flags & TRANS_SHADOW) != 0);
bool trans_shadow = ((flags & fc::trans_shadow) != 0);
if ( isMonochron() && ! trans_shadow )
return;

View File

@ -69,17 +69,6 @@
#include "fterm.h"
// widget flags
#define SHADOW 0x00000001
#define TRANS_SHADOW 0x00000002
#define ACTIVE 0x00000004
#define FOCUS 0x00000008
#define SCROLLABLE 0x00000010
#define RESIZEABLE 0x00000020
#define MODAL 0x00000040
#define FLAT 0x00000080
#define NO_UNDERLINE 0x00000100
// Callback macros
#define _FUNCTION_CALLBACK(h) \
reinterpret_cast<FWidget::FCallback>((h))

View File

@ -200,9 +200,9 @@ void FWindow::swapWindow (FWidget* obj1, FWidget* obj2)
return;
if ( window_list->empty() )
return;
if ( (obj1->getFlags() & MODAL) != 0 )
if ( (obj1->getFlags() & fc::modal) != 0 )
return;
if ( (obj2->getFlags() & MODAL) != 0 )
if ( (obj2->getFlags() & fc::modal) != 0 )
return;
iter = window_list->begin();
@ -236,7 +236,7 @@ bool FWindow::raiseWindow (FWidget* obj)
return false;
if ( window_list->back() == obj )
return false;
if ( (window_list->back()->getFlags() & MODAL) != 0 )
if ( (window_list->back()->getFlags() & fc::modal) != 0 )
return false;
iter = window_list->begin();
@ -269,7 +269,7 @@ bool FWindow::lowerWindow (FWidget* obj)
return false;
if ( window_list->front() == obj )
return false;
if ( (obj->getFlags() & MODAL) != 0 )
if ( (obj->getFlags() & fc::modal) != 0 )
return false;
iter = window_list->begin();