The widget flags are now stored in a bit field

This commit is contained in:
Markus Gans 2018-11-04 23:00:06 +01:00
parent 1f8d16791a
commit 5a356664b2
24 changed files with 139 additions and 224 deletions

View File

@ -1,3 +1,6 @@
2018-11-04 Markus Gans <guru.mail@muenster.de>
* Widget flags are now stored in a bit field
2018-11-03 Markus Gans <guru.mail@muenster.de>
* New method rgb2ColorIndex() to converts a 24-bit RGB color
to a 256-color compatible approximation

View File

@ -12,6 +12,7 @@
&#160;&#160;&#160;&#160;&#160;[![documented](https://codedocs.xyz/gansm/finalcut.svg)](https://codedocs.xyz/gansm/finalcut/hierarchy.html)
The FINAL CUT is a C++ class library and widget toolkit with full mouse support for creating a [text-based user interface](https://en.wikipedia.org/wiki/Text-based_user_interface). The library supports the programmer to develop an application for the text console. It allows the simultaneous handling of multiple text windows on the screen.
The structure of the Qt framework was originally the inspiration for the C++ class design of FINAL CUT. It provides common controls like dialog boxes, push buttons, check boxes, radio buttons, input lines, list boxes, status bars and so on.
### Installation

View File

@ -7,7 +7,8 @@ support for creating a text-based user interface. The library supports
the programmer to develop an application for the text console. It allows
the simultaneous handling of multiple text windows on the screen.
The C++ class design was inspired by the Qt framework. It provides
common controls like dialog boxes, push buttons, check boxes,
radio buttons, input lines, list boxes, status bars and so on.
The structure of the Qt framework was originally the inspiration for
the C++ class design of FINAL CUT. It provides common controls like
dialog boxes, push buttons, check boxes, radio buttons, input lines,
list boxes, status bars and so on.

View File

@ -188,7 +188,7 @@ bool FApplication::sendEvent ( const FObject* receiver
// block events for widgets in non modal windows
if ( window
&& (window->getFlags() & fc::modal) == 0
&& ! window->getFlags().modal
&& ! window->isMenuWidget() )
{
switch ( event->type() )

View File

@ -157,12 +157,7 @@ void FButton::setInactiveBackgroundColor (short color)
//----------------------------------------------------------------------
bool FButton::setNoUnderline (bool on)
{
if ( on )
flags |= fc::no_underline;
else
flags &= ~fc::no_underline;
return on;
return (flags.no_underline = on);
}
//----------------------------------------------------------------------
@ -211,11 +206,7 @@ bool FButton::setFocus (bool on)
//----------------------------------------------------------------------
bool FButton::setFlat (bool on)
{
if ( on )
flags |= fc::flat;
else
flags &= ~fc::flat;
return on;
return (flags.flat = on);
}
//----------------------------------------------------------------------
@ -225,16 +216,16 @@ bool FButton::setShadow (bool on)
&& getEncoding() != fc::VT100
&& getEncoding() != fc::ASCII )
{
flags |= fc::shadow;
flags.shadow = true;
setShadowSize(1,1);
}
else
{
flags &= ~fc::shadow;
flags.shadow = false;
setShadowSize(0,0);
}
return on;
return flags.shadow;
}
//----------------------------------------------------------------------
@ -465,13 +456,12 @@ void FButton::init()
//----------------------------------------------------------------------
void FButton::getButtonState()
{
int active_focus = fc::active + fc::focus;
is.active_focus = ((flags & active_focus) == active_focus);
is.active = ((flags & fc::active) != 0);
is.focus = ((flags & fc::focus) != 0);
is.active_focus = flags.active && flags.focus;
is.active = flags.active;
is.focus = flags.focus;
is.flat = isFlat();
is.non_flat_shadow = ((flags & (fc::shadow + fc::flat)) == fc::shadow);
is.no_underline = ((flags & fc::no_underline) != 0);
is.non_flat_shadow = ! flags.flat && flags.shadow;
is.no_underline = flags.no_underline;
}
//----------------------------------------------------------------------
@ -666,10 +656,14 @@ inline void FButton::drawTopBottomBackground()
inline void FButton::drawButtonTextLine (wchar_t button_text[])
{
std::size_t pos;
center_offset = (getWidth() - txtlength - 1) / 2;
setPrintPos (2 + int(indent), 1 + int(vcenter_offset));
setColor (button_fg, button_bg);
if ( getWidth() < txtlength + 1 )
center_offset = 0;
else
center_offset = (getWidth() - txtlength - 1) / 2;
// Print button text line --------
for (pos = 0; pos < center_offset; pos++)
print (space_char); // █

View File

@ -543,9 +543,6 @@ bool FButtonGroup::isRadioButton (FToggleButton* button) const
//----------------------------------------------------------------------
void FButtonGroup::init()
{
if ( isEnabled() )
flags |= fc::active;
setForegroundColor (wc.label_fg);
setBackgroundColor (wc.label_bg);
setMinimumSize (7, 4);
@ -582,9 +579,6 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
, std::size_t hotkeypos
, std::size_t length )
{
bool isActive = ((flags & fc::active) != 0);
bool isNoUnderline = ((flags & fc::no_underline) != 0);
if ( isMonochron() )
setReverse(true);
@ -595,16 +589,16 @@ void FButtonGroup::drawText ( wchar_t LabelText[]
for (std::size_t z = 0; z < length; z++)
{
if ( (z == hotkeypos) && isActive )
if ( (z == hotkeypos) && flags.active )
{
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
if ( ! isNoUnderline )
if ( ! flags.no_underline )
setUnderline();
print (LabelText[z]);
if ( ! isNoUnderline )
if ( ! flags.no_underline )
unsetUnderline();
setColor (wc.label_emphasis_fg, wc.label_bg);

View File

@ -103,16 +103,12 @@ bool FDialog::setDialogWidget (bool on)
if ( isDialogWidget() == on )
return true;
flags.dialog_widget = on;
if ( on )
{
flags |= fc::dialog_widget;
setTermOffsetWithPadding();
}
else
{
flags &= ~fc::dialog_widget;
setParentOffset();
}
return on;
}
@ -123,16 +119,12 @@ bool FDialog::setModal (bool on)
if ( isModal() == on )
return true;
flags.modal = on;
if ( on )
{
flags |= fc::modal;
modal_dialogs++;
}
else
{
flags &= ~fc::modal;
modal_dialogs--;
}
return on;
}
@ -141,12 +133,7 @@ bool FDialog::setModal (bool on)
//----------------------------------------------------------------------
bool FDialog::setScrollable (bool on)
{
if ( on )
flags |= fc::scrollable;
else
flags &= ~fc::scrollable;
return on;
return (flags.scrollable = on);
}
//----------------------------------------------------------------------
@ -835,7 +822,7 @@ void FDialog::draw()
drawTitleBar();
setCursorPos(2, int(getHeight()) - 1);
if ( (flags & fc::shadow) != 0 )
if ( flags.shadow )
drawDialogShadow();
if ( isMonochron() )
@ -845,7 +832,7 @@ void FDialog::draw()
//----------------------------------------------------------------------
void FDialog::drawDialogShadow()
{
if ( isMonochron() && (flags & fc::trans_shadow) == 0 )
if ( isMonochron() && ! flags.trans_shadow )
return;
drawShadow();

View File

@ -597,9 +597,6 @@ void FLabel::printLine ( wchar_t line[]
{
std::size_t to_char;
std::size_t width = std::size_t(getWidth());
bool isActive, isNoUnderline;
isActive = ((flags & fc::active) != 0);
isNoUnderline = ((flags & fc::no_underline) != 0);
if ( align_offset > 0 )
print (FString(align_offset, ' ')); // leading spaces
@ -623,16 +620,16 @@ void FLabel::printLine ( wchar_t line[]
}
}
if ( z == hotkeypos && isActive )
if ( z == hotkeypos && flags.active )
{
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
if ( ! isNoUnderline )
if ( ! flags.no_underline )
setUnderline();
print (line[z]);
if ( ! isNoUnderline )
if ( ! flags.no_underline )
unsetUnderline();
if ( hasEmphasis() )

View File

@ -239,16 +239,16 @@ bool FLineEdit::setShadow (bool on)
&& getEncoding() != fc::VT100
&& getEncoding() != fc::ASCII )
{
flags |= fc::shadow;
flags.shadow = true;
setShadowSize(1,1);
}
else
{
flags &= ~fc::shadow;
flags.shadow = false;
setShadowSize(0,0);
}
return on;
return flags.shadow;
}
//----------------------------------------------------------------------
@ -698,11 +698,9 @@ bool FLineEdit::hasHotkey()
//----------------------------------------------------------------------
void FLineEdit::draw()
{
bool isFocus;
drawInputField();
isFocus = ((flags & fc::focus) != 0);
if ( isFocus && getStatusBar() )
if ( flags.focus && getStatusBar() )
{
const FString& msg = getStatusbarMessage();
const FString& curMsg = getStatusBar()->getMessage();
@ -718,12 +716,9 @@ void FLineEdit::draw()
//----------------------------------------------------------------------
void FLineEdit::drawInputField()
{
bool isActiveFocus, isShadow;
std::size_t x;
FString show_text;
int active_focus = fc::active + fc::focus;
isActiveFocus = ((flags & active_focus) == active_focus);
isShadow = ((flags & fc::shadow) != 0 );
bool isActiveFocus = flags.active && flags.focus;
setPrintPos (1, 1);
if ( isMonochron() )
@ -776,7 +771,7 @@ void FLineEdit::drawInputField()
setUnderline(false);
}
if ( isShadow )
if ( flags.shadow )
drawShadow ();
// set the cursor to the first pos.

View File

@ -872,8 +872,6 @@ void FListBox::init()
//----------------------------------------------------------------------
void FListBox::draw()
{
bool isFocus;
if ( current < 1 )
current = 1;
@ -910,9 +908,8 @@ void FListBox::draw()
hbar->redraw();
drawList();
isFocus = ((flags & fc::focus) != 0);
if ( isFocus && getStatusBar() )
if ( flags.focus && getStatusBar() )
{
const FString& msg = getStatusbarMessage();
const FString& curMsg = getStatusBar()->getMessage();
@ -1017,14 +1014,13 @@ inline void FListBox::drawListLine ( int y
std::size_t i, len;
std::size_t inc_len = inc_search.getLength();
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
bool isFocus = ((flags & fc::focus) != 0);
FString element;
element = getString(iter).mid ( std::size_t(1 + xoffset)
, getWidth() - nf_offset - 4 );
const wchar_t* const& element_str = element.wc_str();
len = element.getLength();
if ( isMonochron() && isCurrentLine && isFocus )
if ( isMonochron() && isCurrentLine && flags.focus )
print (fc::BlackRightPointingPointer); // ►
else
print (' ');
@ -1035,14 +1031,14 @@ inline void FListBox::drawListLine ( int y
for (i = 0; i < len; i++)
{
if ( serach_mark && i == inc_len && isFocus )
if ( serach_mark && i == inc_len && flags.focus )
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
print (element_str[i]);
}
if ( isMonochron() && isCurrentLine && isFocus )
if ( isMonochron() && isCurrentLine && flags.focus )
{
print (fc::BlackLeftPointingPointer); // ◄
i++;
@ -1116,9 +1112,8 @@ inline void FListBox::drawListBracketsLine ( int y
, i = 0
, b = 0;
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
bool isFocus = ((flags & fc::focus) != 0);
if ( isMonochron() && isCurrentLine && isFocus )
if ( isMonochron() && isCurrentLine && flags.focus )
print (fc::BlackRightPointingPointer); // ►
else
print (' ');
@ -1164,7 +1159,7 @@ inline void FListBox::drawListBracketsLine ( int y
i++;
}
if ( isMonochron() && isCurrentLine && isFocus )
if ( isMonochron() && isCurrentLine && flags.focus )
{
print (fc::BlackLeftPointingPointer); // ◄
i++;
@ -1180,10 +1175,8 @@ inline void FListBox::setLineAttributes ( int y
, bool lineHasBrackets
, bool& serach_mark )
{
bool isFocus = ((flags & fc::focus) != 0)
, isCurrentLine = bool(y + yoffset + 1 == int(current));
bool isCurrentLine = bool(y + yoffset + 1 == int(current));
std::size_t inc_len = inc_search.getLength();
setPrintPos (2, 2 + int(y));
if ( isLineSelected )
@ -1203,14 +1196,14 @@ inline void FListBox::setLineAttributes ( int y
if ( isCurrentLine )
{
if ( isFocus && getMaxColor() < 16 )
if ( flags.focus && getMaxColor() < 16 )
setBold();
if ( isLineSelected )
{
if ( isMonochron() )
setBold();
else if ( isFocus )
else if ( flags.focus )
setColor ( wc.selected_current_element_focus_fg
, wc.selected_current_element_focus_bg );
else
@ -1224,7 +1217,7 @@ inline void FListBox::setLineAttributes ( int y
if ( isMonochron() )
unsetBold();
if ( isFocus )
if ( flags.focus )
{
setColor ( wc.current_element_focus_fg
, wc.current_element_focus_bg );
@ -1251,7 +1244,7 @@ inline void FListBox::setLineAttributes ( int y
{
if ( isMonochron() )
setReverse(true);
else if ( isFocus && getMaxColor() < 16 )
else if ( flags.focus && getMaxColor() < 16 )
unsetBold();
}
}

View File

@ -1481,8 +1481,6 @@ std::size_t FListView::getAlignOffset ( fc::text_alignment align
//----------------------------------------------------------------------
void FListView::draw()
{
bool isFocus;
if ( current_iter.getPosition() < 1 )
current_iter = itemlist.begin();
@ -1519,9 +1517,8 @@ void FListView::draw()
hbar->redraw();
drawList();
isFocus = ((flags & fc::focus) != 0);
if ( isFocus && getStatusBar() )
if ( flags.focus && getStatusBar() )
{
const FString& msg = getStatusbarMessage();
const FString& curMsg = getStatusBar()->getMessage();
@ -1587,7 +1584,6 @@ void FListView::drawColumnLabels()
void FListView::drawList()
{
uInt page_height, y;
bool is_focus;
FListViewIterator iter;
if ( itemlist.empty() || getHeight() <= 2 || getWidth() <= 4 )
@ -1595,7 +1591,6 @@ void FListView::drawList()
y = 0;
page_height = uInt(getHeight() - 2);
is_focus = ((flags & fc::focus) != 0);
iter = first_visible_line;
while ( iter != itemlist.end() && y < page_height )
@ -1605,9 +1600,9 @@ void FListView::drawList()
setPrintPos (2, 2 + int(y));
// Draw one FListViewItem
drawListLine (item, is_focus, is_current_line);
drawListLine (item, flags.focus, is_current_line);
if ( is_focus && is_current_line )
if ( flags.focus && is_current_line )
setCursorPos (3, 2 + int(y)); // first character
last_visible_line = iter;

View File

@ -82,12 +82,7 @@ bool FMenu::setMenuWidget (bool on)
if ( isMenuWidget() == on )
return true;
if ( on )
flags |= fc::menu_widget;
else
flags &= ~fc::menu_widget;
return on;
return (flags.menu_widget = on);
}
//----------------------------------------------------------------------
@ -1350,7 +1345,7 @@ inline void FMenu::drawMenuLine (FMenuItem* menuitem, int y)
to_char--;
txtdata.length = to_char;
txtdata.no_underline = ((menuitem->getFlags() & fc::no_underline) != 0);
txtdata.no_underline = menuitem->getFlags().no_underline;
setCursorToHotkeyPosition (menuitem);
if ( ! is_enabled || is_selected )

View File

@ -554,7 +554,7 @@ inline void FMenuBar::drawItem (FMenuItem* menuitem, std::size_t& x)
bool is_selected = menuitem->isSelected();
txtdata.startpos = x + 1;
txtdata.no_underline = ((menuitem->getFlags() & fc::no_underline) != 0);
txtdata.no_underline = menuitem->getFlags().no_underline;
// Set screen attributes
setLineAttributes (menuitem);

View File

@ -83,12 +83,12 @@ bool FProgressbar::setShadow (bool on)
&& getEncoding() != fc::VT100
&& getEncoding() != fc::ASCII )
{
flags |= fc::shadow;
flags.shadow = true;
setShadowSize(1,1);
}
else
{
flags &= ~fc::shadow;
flags.shadow = false;
setShadowSize(0,0);
}
@ -157,7 +157,7 @@ void FProgressbar::draw()
drawPercentage();
drawBar();
if ( (flags & fc::shadow) != 0 )
if ( flags.shadow )
drawShadow ();
flush_out();

View File

@ -109,12 +109,7 @@ void FToggleButton::setGeometry (int x, int y, std::size_t w, std::size_t h, boo
//----------------------------------------------------------------------
bool FToggleButton::setNoUnderline (bool on)
{
if ( on )
flags |= fc::no_underline;
else
flags &= ~fc::no_underline;
return on;
return (flags.no_underline = on);
}
//----------------------------------------------------------------------
@ -464,9 +459,7 @@ bool FToggleButton::isCheckboxButton() const
//----------------------------------------------------------------------
void FToggleButton::draw()
{
bool isFocus = ((flags & fc::focus) != 0);
if ( isFocus && getStatusBar() )
if ( flags.focus && getStatusBar() )
{
const FString& msg = getStatusbarMessage();
const FString& curMsg = getStatusBar()->getMessage();
@ -652,9 +645,6 @@ void FToggleButton::drawText ( wchar_t LabelText[]
, std::size_t hotkeypos
, std::size_t length )
{
bool isActive = ((flags & fc::active) != 0);
bool isNoUnderline = ((flags & fc::no_underline) != 0);
if ( isMonochron() )
setReverse(true);
@ -665,16 +655,16 @@ void FToggleButton::drawText ( wchar_t LabelText[]
for (std::size_t z = 0; z < length; z++)
{
if ( (z == hotkeypos) && isActive )
if ( (z == hotkeypos) && flags.active )
{
setColor (wc.label_hotkey_fg, wc.label_hotkey_bg);
if ( ! isNoUnderline )
if ( ! flags.no_underline )
setUnderline();
print ( LabelText[z] );
if ( ! isNoUnderline )
if ( ! flags.no_underline )
unsetUnderline();
setColor (wc.label_fg, wc.label_bg);

View File

@ -58,13 +58,11 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
: FVTerm(bool(! parent), disable_alt_screen)
, FObject(parent)
, accelerator_list(0)
, flags(0)
, flags()
, callback_objects()
, member_callback_objects()
, enable(true)
, visible(true)
, shown(false)
, focus(false)
, focusable(true)
, visible_cursor(true)
, widget_cursor_position(-1, -1)
@ -84,8 +82,11 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
, background_color(fc::Default)
, statusbar_message()
{
if ( isEnabled() )
flags |= fc::active;
// init bit field with 0
memset (&flags, 0, sizeof(flags));
// Enable widget by default
flags.active = true;
widget_object = true;
@ -124,7 +125,7 @@ FWidget::~FWidget() // destructor
setClickedWidget(0);
// unset the local window widget focus
if ( focus )
if ( flags.focus )
{
if ( FWindow* window = FWindow::getWindowWidget(this) )
window->setWindowFocusWidget(0);
@ -276,12 +277,7 @@ void FWidget::setMainWidget (FWidget* obj)
//----------------------------------------------------------------------
bool FWidget::setEnable (bool on)
{
if ( on )
flags |= fc::active;
else
flags &= ~fc::active;
return enable = on;
return (flags.active = on);
}
//----------------------------------------------------------------------
@ -290,21 +286,16 @@ bool FWidget::setFocus (bool on)
FWindow* window;
FWidget* last_focus;
if ( ! enable )
if ( ! isEnabled() )
return false;
if ( on )
flags |= fc::focus;
else
flags &= ~fc::focus;
if ( on == focus )
if ( flags.focus == on )
return true;
last_focus = FWidget::getFocusWidget();
// set widget focus
if ( on && ! focus )
if ( on && ! flags.focus )
{
int focusable_children = numOfFocusableChildren();
@ -334,7 +325,7 @@ bool FWidget::setFocus (bool on)
window->setWindowFocusWidget(this);
}
return focus = on;
return (flags.focus = on);
}
//----------------------------------------------------------------------
@ -659,7 +650,7 @@ bool FWidget::setCursorPos (int x, int y)
widget_cursor_position.setPoint(x, y);
if ( (flags & fc::focus) == 0 || isWindowWidget() )
if ( ! flags.focus || isWindowWidget() )
return false;
if ( ! FWindow::getWindowWidget(this) )
@ -856,7 +847,7 @@ bool FWidget::close()
{
hide();
if ( (flags & fc::modal) == 0 )
if ( ! flags.modal )
close_widget->push_back(this);
}
return true;
@ -1266,13 +1257,11 @@ void FWidget::move (int dx, int dy)
//----------------------------------------------------------------------
void FWidget::drawShadow()
{
bool trans_shadow = ((flags & fc::trans_shadow) != 0);
if ( isMonochron() && ! trans_shadow )
if ( isMonochron() && ! flags.trans_shadow )
return;
if ( (getEncoding() == fc::VT100 && ! trans_shadow)
|| (getEncoding() == fc::ASCII && ! trans_shadow) )
if ( (getEncoding() == fc::VT100 && ! flags.trans_shadow)
|| (getEncoding() == fc::ASCII && ! flags.trans_shadow) )
{
clearShadow();
return;
@ -1283,7 +1272,7 @@ void FWidget::drawShadow()
, y1 = 1
, y2 = int(getHeight());
if ( trans_shadow )
if ( flags.trans_shadow )
{
// transparent shadow
drawTransparentShadow (x1, y1, x2, y2);

View File

@ -93,16 +93,12 @@ bool FWindow::setWindowWidget (bool on)
if ( isWindowWidget() == on )
return true;
flags.window_widget = on;
if ( on )
{
flags |= fc::window_widget;
setTermOffset();
}
else
{
flags &= ~fc::window_widget;
setParentOffset();
}
return on;
}
@ -179,29 +175,18 @@ void FWindow::unsetActiveWindow()
//----------------------------------------------------------------------
bool FWindow::setResizeable (bool on)
{
if ( on )
flags |= fc::resizeable;
else
flags &= ~fc::resizeable;
return on;
return (flags.resizeable = on);
}
//----------------------------------------------------------------------
bool FWindow::setTransparentShadow (bool on)
{
flags.shadow = flags.trans_shadow = on;
if ( on )
{
flags |= fc::shadow;
flags |= fc::trans_shadow;
setShadowSize (2,1);
}
else
{
flags &= ~fc::shadow;
flags &= ~fc::trans_shadow;
setShadowSize (0,0);
}
return on;
}
@ -214,14 +199,14 @@ bool FWindow::setShadow (bool on)
if ( on )
{
flags |= fc::shadow;
flags &= ~fc::trans_shadow;
flags.shadow = true;
flags.trans_shadow = false;
setShadowSize (1,1);
}
else
{
flags &= ~fc::shadow;
flags &= ~fc::trans_shadow;
flags.shadow = false;
flags.trans_shadow = false;
setShadowSize (0,0);
}
@ -234,10 +219,10 @@ bool FWindow::setAlwaysOnTop (bool on)
if ( isAlwaysOnTop() == on )
return true;
flags.always_on_top = on;
if ( on )
{
flags |= fc::always_on_top;
if ( always_on_top_list )
{
deleteFromAlwaysOnTopList (this);
@ -245,10 +230,7 @@ bool FWindow::setAlwaysOnTop (bool on)
}
}
else
{
flags &= ~fc::always_on_top;
deleteFromAlwaysOnTopList (this);
}
return on;
}
@ -580,10 +562,10 @@ void FWindow::swapWindow (FWidget* obj1, FWidget* obj2)
if ( window_list->empty() )
return;
if ( (obj1->getFlags() & fc::modal) != 0 )
if ( obj1->getFlags().modal )
return;
if ( (obj2->getFlags() & fc::modal) != 0 )
if ( obj2->getFlags().modal )
return;
iter = window_list->begin();
@ -623,7 +605,7 @@ bool FWindow::raiseWindow (FWidget* obj)
if ( window_list->back() == obj )
return false;
if ( (window_list->back()->getFlags() & fc::modal) != 0
if ( window_list->back()->getFlags().modal
&& ! obj->isMenuWidget() )
return false;
@ -665,7 +647,7 @@ bool FWindow::lowerWindow (FWidget* obj)
if ( window_list->front() == obj )
return false;
if ( (obj->getFlags() & fc::modal) != 0 )
if ( obj->getFlags().modal )
return false;
iter = window_list->begin();

View File

@ -265,7 +265,7 @@ inline bool FButton::unsetClickAnimation()
//----------------------------------------------------------------------
inline bool FButton::isFlat() const
{ return ((flags & fc::flat) != 0); }
{ return flags.flat; }
//----------------------------------------------------------------------
inline bool FButton::isDown() const
@ -273,7 +273,7 @@ inline bool FButton::isDown() const
//----------------------------------------------------------------------
inline bool FButton::hasShadow() const
{ return ((flags & fc::shadow) != 0); }
{ return flags.shadow; }
//----------------------------------------------------------------------
inline bool FButton::hasClickAnimation()

View File

@ -79,24 +79,6 @@ enum events
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,
window_widget = 0x00000080,
dialog_widget = 0x00000100,
menu_widget = 0x00000200,
always_on_top = 0x00000400,
flat = 0x00000800,
no_underline = 0x00001000
};
// Internal character encoding
enum encoding
{

View File

@ -282,11 +282,11 @@ inline void FDialog::setText (const FString& txt)
//----------------------------------------------------------------------
inline bool FDialog::isModal()
{ return ((flags & fc::modal) != 0); }
{ return flags.modal; }
//----------------------------------------------------------------------
inline bool FDialog::isScrollable()
{ return ((flags & fc::scrollable) != 0); }
{ return flags.scrollable; }
} // namespace finalcut

View File

@ -227,7 +227,7 @@ inline bool FLineEdit::unsetShadow()
//----------------------------------------------------------------------
inline bool FLineEdit::hasShadow()
{ return ((flags & fc::shadow) != 0); }
{ return flags.shadow; }
} // namespace finalcut

View File

@ -129,7 +129,7 @@ inline bool FProgressbar::unsetShadow()
//----------------------------------------------------------------------
inline bool FProgressbar::hasShadow()
{ return ((flags & fc::shadow) != 0); }
{ return flags.shadow; }
} // namespace finalcut

View File

@ -142,6 +142,8 @@ class FWidget : public FVTerm, public FObject
typedef void (FWidget::*FMemberCallback)(FWidget*, data_ptr);
typedef std::vector<accelerator> Accelerators;
struct widget_flags; // forward declaration
// Constructor
explicit FWidget (FWidget* = 0, bool = false);
@ -188,7 +190,7 @@ class FWidget : public FVTerm, public FObject
const FRect& getTermGeometryWithShadow();
std::size_t getDesktopWidth();
std::size_t getDesktopHeight();
int getFlags() const;
widget_flags getFlags() const;
FPoint getCursorPos();
FPoint getPrintPos();
std::vector<bool>& doubleFlatLine_ref (fc::sides);
@ -373,7 +375,24 @@ class FWidget : public FVTerm, public FObject
virtual void onClose (FCloseEvent*);
// Data Members
int flags;
struct widget_flags // Properties of a widget ⚑
{
uInt32 shadow : 1;
uInt32 trans_shadow : 1;
uInt32 active : 1;
uInt32 focus : 1;
uInt32 scrollable : 1;
uInt32 resizeable : 1;
uInt32 modal : 1;
uInt32 window_widget : 1;
uInt32 dialog_widget : 1;
uInt32 menu_widget : 1;
uInt32 always_on_top : 1;
uInt32 flat : 1;
uInt32 no_underline : 1;
uInt32 : 19; // padding bits
} flags;
static uInt modal_dialogs;
static FWidgetColors wc;
static widgetList* dialog_list;
@ -407,10 +426,8 @@ class FWidget : public FVTerm, public FObject
static void setColorTheme();
// Data Members
bool enable;
bool visible;
bool shown;
bool focus;
bool focusable;
bool visible_cursor;
FPoint widget_cursor_position;
@ -685,7 +702,7 @@ inline std::size_t FWidget::getDesktopHeight()
{ return getLineNumber(); }
//----------------------------------------------------------------------
inline int FWidget::getFlags() const
inline FWidget::widget_flags FWidget::getFlags() const
{ return flags; }
//----------------------------------------------------------------------
@ -873,19 +890,19 @@ inline bool FWidget::isShown() const
//----------------------------------------------------------------------
inline bool FWidget::isWindowWidget() const
{ return ((flags & fc::window_widget) != 0); }
{ return flags.window_widget; }
//----------------------------------------------------------------------
inline bool FWidget::isDialogWidget() const
{ return ((flags & fc::dialog_widget) != 0); }
{ return flags.dialog_widget; }
//----------------------------------------------------------------------
inline bool FWidget::isMenuWidget() const
{ return ((flags & fc::menu_widget) != 0); }
{ return flags.menu_widget; }
//----------------------------------------------------------------------
inline bool FWidget::isEnabled() const
{ return enable; }
{ return flags.active; }
//----------------------------------------------------------------------
inline bool FWidget::hasVisibleCursor() const
@ -893,7 +910,7 @@ inline bool FWidget::hasVisibleCursor() const
//----------------------------------------------------------------------
inline bool FWidget::hasFocus() const
{ return focus; }
{ return flags.focus; }
//----------------------------------------------------------------------
inline bool FWidget::acceptFocus() const // is focusable

View File

@ -250,19 +250,19 @@ inline bool FWindow::isWindowActive() const
//----------------------------------------------------------------------
inline bool FWindow::isResizeable() const
{ return ((flags & fc::resizeable) != 0); }
{ return flags.resizeable; }
//----------------------------------------------------------------------
inline bool FWindow::isAlwaysOnTop() const
{ return ((flags & fc::always_on_top) != 0); }
{ return flags.always_on_top; }
//----------------------------------------------------------------------
inline bool FWindow::hasTransparentShadow() const
{ return ((flags & fc::trans_shadow) != 0); }
{ return flags.trans_shadow; }
//----------------------------------------------------------------------
inline bool FWindow::hasShadow() const
{ return ((flags & fc::shadow) != 0); }
{ return flags.shadow; }
//----------------------------------------------------------------------
inline FWindow* FWindow::getWindowWidgetAt (const FPoint& pos)