From 56e5847d4105b77d4a316e762bc5e035711bcb02 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Sun, 24 Jan 2016 14:53:09 +0100 Subject: [PATCH] Moving widget flags into the class fc --- ChangeLog | 3 +++ src/fapp.cpp | 2 +- src/fbutton.cpp | 34 ++++++++++++------------- src/fbutton.h | 4 +-- src/fbuttongroup.cpp | 10 ++++---- src/fconfig.h | 4 +-- src/fdialog.cpp | 58 +++++++++++++++++++++---------------------- src/fdialog.h | 10 ++++---- src/fenum.h | 14 +++++++++++ src/flabel.cpp | 10 ++++---- src/flineedit.cpp | 24 +++++++++--------- src/flineedit.h | 2 +- src/flistbox.cpp | 20 +++++++-------- src/flistbox.h | 2 +- src/fmenu.cpp | 12 ++++----- src/fmenu.h | 2 +- src/fmenubar.cpp | 2 +- src/fmenuitem.cpp | 12 ++++----- src/fprogressbar.cpp | 10 ++++---- src/fprogressbar.h | 2 +- src/ftogglebutton.cpp | 22 ++++++++-------- src/fwidget.cpp | 4 +-- src/fwidget.h | 11 -------- src/fwindow.cpp | 8 +++--- 24 files changed, 144 insertions(+), 138 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d12f313..7a4619f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2016-01-24 Markus Gans + * Moving widget flags into the class fc + 2016-01-17 Markus Gans * Moving events into the class fc * Avoid height and width underflow in adjustSize() diff --git a/src/fapp.cpp b/src/fapp.cpp index 87f802d7..4cad1cc8 100644 --- a/src/fapp.cpp +++ b/src/fapp.cpp @@ -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() ) { diff --git a/src/fbutton.cpp b/src/fbutton.cpp index 26d82136..921e1884 100644 --- a/src/fbutton.cpp +++ b/src/fbutton.cpp @@ -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(txt.wc_str()); dest = const_cast(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; } diff --git a/src/fbutton.h b/src/fbutton.h index dedd5a8b..0d1dbdc7 100644 --- a/src/fbutton.h +++ b/src/fbutton.h @@ -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() diff --git a/src/fbuttongroup.cpp b/src/fbuttongroup.cpp index 7cde3384..d3a689f5 100644 --- a/src/fbuttongroup.cpp +++ b/src/fbuttongroup.cpp @@ -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(txt.wc_str()); dest = const_cast(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; diff --git a/src/fconfig.h b/src/fconfig.h index caf06d89..b299f2ba 100644 --- a/src/fconfig.h +++ b/src/fconfig.h @@ -1,6 +1,6 @@ #ifndef _SRC_FCONFIG_H #define _SRC_FCONFIG_H 1 - + /* src/fconfig.h. Generated automatically at end of configure. */ /* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ @@ -171,6 +171,6 @@ #ifndef F_VERSION #define F_VERSION "0.2.0" #endif - + /* once: _SRC_FCONFIG_H */ #endif diff --git a/src/fdialog.cpp b/src/fdialog.cpp index fdd98520..906cb79e 100644 --- a/src/fdialog.cpp +++ b/src/fdialog.cpp @@ -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(*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(*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(*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(*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; } diff --git a/src/fdialog.h b/src/fdialog.h index 9e0dde59..9f127259 100644 --- a/src/fdialog.h +++ b/src/fdialog.h @@ -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 diff --git a/src/fenum.h b/src/fenum.h index 3dac5397..240f72d1 100644 --- a/src/fenum.h +++ b/src/fenum.h @@ -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 { diff --git a/src/flabel.cpp b/src/flabel.cpp index 5d11fa01..fb08ac44 100644 --- a/src/flabel.cpp +++ b/src/flabel.cpp @@ -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; diff --git a/src/flineedit.cpp b/src/flineedit.cpp index 27e50821..9c8dc8c1 100644 --- a/src/flineedit.cpp +++ b/src/flineedit.cpp @@ -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; } diff --git a/src/flineedit.h b/src/flineedit.h index 7fba5f4c..8ad3e65c 100644 --- a/src/flineedit.h +++ b/src/flineedit.h @@ -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 diff --git a/src/flistbox.cpp b/src/flistbox.cpp index b591eed0..2a09b8cd 100644 --- a/src/flistbox.cpp +++ b/src/flistbox.cpp @@ -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; } diff --git a/src/flistbox.h b/src/flistbox.h index d566b0fd..93a67276 100644 --- a/src/flistbox.h +++ b/src/flistbox.h @@ -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() diff --git a/src/fmenu.cpp b/src/fmenu.cpp index 43d5912b..38887412 100644 --- a/src/fmenu.cpp +++ b/src/fmenu.cpp @@ -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(); diff --git a/src/fmenu.h b/src/fmenu.h index e5398b3b..7484ba1b 100644 --- a/src/fmenu.h +++ b/src/fmenu.h @@ -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) diff --git a/src/fmenubar.cpp b/src/fmenubar.cpp index 7cdf19ed..b3c69c9f 100644 --- a/src/fmenubar.cpp +++ b/src/fmenubar.cpp @@ -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 ) { diff --git a/src/fmenuitem.cpp b/src/fmenuitem.cpp index b9929884..dee4cc78 100644 --- a/src/fmenuitem.cpp +++ b/src/fmenuitem.cpp @@ -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(); diff --git a/src/fprogressbar.cpp b/src/fprogressbar.cpp index d59596cb..42b8142f 100644 --- a/src/fprogressbar.cpp +++ b/src/fprogressbar.cpp @@ -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; } diff --git a/src/fprogressbar.h b/src/fprogressbar.h index 0730985d..d21dadc3 100644 --- a/src/fprogressbar.h +++ b/src/fprogressbar.h @@ -102,7 +102,7 @@ inline bool FProgressbar::unsetShadow() //---------------------------------------------------------------------- inline bool FProgressbar::hasShadow() -{ return ((flags & SHADOW) != 0); } +{ return ((flags & fc::shadow) != 0); } #endif // _FPROGRESSBAR_H diff --git a/src/ftogglebutton.cpp b/src/ftogglebutton.cpp index 3390880a..9031dcbc 100644 --- a/src/ftogglebutton.cpp +++ b/src/ftogglebutton.cpp @@ -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(txt.wc_str()); dest = const_cast(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() ) { diff --git a/src/fwidget.cpp b/src/fwidget.cpp index cac6c56f..07f36b93 100644 --- a/src/fwidget.cpp +++ b/src/fwidget.cpp @@ -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; diff --git a/src/fwidget.h b/src/fwidget.h index 6cda00f8..0c9c5f94 100644 --- a/src/fwidget.h +++ b/src/fwidget.h @@ -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((h)) diff --git a/src/fwindow.cpp b/src/fwindow.cpp index e3ee00b3..6dfee863 100644 --- a/src/fwindow.cpp +++ b/src/fwindow.cpp @@ -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();