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> 2016-01-17 Markus Gans <guru.mail@muenster.de>
* Moving events into the class fc * Moving events into the class fc
* Avoid height and width underflow in adjustSize() * Avoid height and width underflow in adjustSize()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -48,6 +48,20 @@ class fc
Timer_Event // timer event occur 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 // internal character encoding
enum encoding enum encoding
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -69,17 +69,6 @@
#include "fterm.h" #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 // Callback macros
#define _FUNCTION_CALLBACK(h) \ #define _FUNCTION_CALLBACK(h) \
reinterpret_cast<FWidget::FCallback>((h)) reinterpret_cast<FWidget::FCallback>((h))

View File

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