FButton now uses the widget flags directly
This commit is contained in:
parent
f7a75247ef
commit
baabf9546e
|
@ -1,3 +1,6 @@
|
|||
2018-11-05 Markus Gans <guru.mail@muenster.de>
|
||||
* FButton now uses the widget flags directly
|
||||
|
||||
2018-11-04 Markus Gans <guru.mail@muenster.de>
|
||||
* Widget flags are now stored in a bit field
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ Window::Window (finalcut::FWidget* parent)
|
|||
for (int n = 1; n <= 6; n++)
|
||||
{
|
||||
win_data* win_dat = new win_data;
|
||||
win_dat->title.sprintf("Window %d", n);
|
||||
win_dat->title.sprintf("Window %1d", n);
|
||||
windows.push_back(win_dat);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ FButton::FButton(FWidget* parent)
|
|||
: FWidget(parent)
|
||||
, text()
|
||||
, button_down(false)
|
||||
, active_focus(false)
|
||||
, click_animation(true)
|
||||
, click_time(150)
|
||||
, space_char(int(' '))
|
||||
|
@ -52,7 +53,6 @@ FButton::FButton(FWidget* parent)
|
|||
, button_focus_bg(wc.button_active_focus_bg)
|
||||
, button_inactive_fg(wc.button_inactive_fg)
|
||||
, button_inactive_bg(wc.button_inactive_bg)
|
||||
, is()
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ FButton::FButton (const FString& txt, FWidget* parent)
|
|||
: FWidget(parent)
|
||||
, text(txt)
|
||||
, button_down(false)
|
||||
, active_focus(false)
|
||||
, click_animation(true)
|
||||
, click_time(150)
|
||||
, space_char(int(' '))
|
||||
|
@ -77,7 +78,6 @@ FButton::FButton (const FString& txt, FWidget* parent)
|
|||
, button_focus_bg(wc.button_active_focus_bg)
|
||||
, button_inactive_fg(wc.button_inactive_fg)
|
||||
, button_inactive_bg(wc.button_inactive_bg)
|
||||
, is()
|
||||
{
|
||||
init();
|
||||
detectHotkey();
|
||||
|
@ -453,17 +453,6 @@ void FButton::init()
|
|||
setShadow();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void FButton::getButtonState()
|
||||
{
|
||||
is.active_focus = flags.active && flags.focus;
|
||||
is.active = flags.active;
|
||||
is.focus = flags.focus;
|
||||
is.flat = isFlat();
|
||||
is.non_flat_shadow = ! flags.flat && flags.shadow;
|
||||
is.no_underline = flags.no_underline;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
uChar FButton::getHotkey()
|
||||
{
|
||||
|
@ -551,7 +540,7 @@ inline std::size_t FButton::clickAnimationIndent (FWidget* parent_widget)
|
|||
return 0;
|
||||
|
||||
// noshadow + indent one character to the right
|
||||
if ( is.flat )
|
||||
if ( flags.flat )
|
||||
clearFlatBorder();
|
||||
else if ( hasShadow() )
|
||||
clearShadow();
|
||||
|
@ -588,7 +577,7 @@ inline void FButton::clearRightMargin (FWidget* parent_widget)
|
|||
setPrintPos (1 + int(getWidth()), y);
|
||||
print (' '); // clear right
|
||||
|
||||
if ( is.active && isMonochron() )
|
||||
if ( flags.active && isMonochron() )
|
||||
setReverse(false); // Dark background
|
||||
}
|
||||
}
|
||||
|
@ -604,7 +593,7 @@ inline void FButton::drawMarginLeft()
|
|||
{
|
||||
setPrintPos (1 + int(indent), 1 + int(y));
|
||||
|
||||
if ( isMonochron() && is.active_focus && y == vcenter_offset )
|
||||
if ( isMonochron() && active_focus && y == vcenter_offset )
|
||||
print (fc::BlackRightPointingPointer); // ►
|
||||
else
|
||||
print (space_char); // full block █
|
||||
|
@ -620,7 +609,7 @@ inline void FButton::drawMarginRight()
|
|||
{
|
||||
setPrintPos (int(getWidth() + indent), 1 + int(y));
|
||||
|
||||
if ( isMonochron() && is.active_focus && y == vcenter_offset )
|
||||
if ( isMonochron() && active_focus && y == vcenter_offset )
|
||||
print (fc::BlackLeftPointingPointer); // ◄
|
||||
else
|
||||
print (space_char); // full block █
|
||||
|
@ -675,32 +664,32 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
|||
setCursorPos ( 2 + int(center_offset + hotkeypos)
|
||||
, 1 + int(vcenter_offset) ); // hotkey
|
||||
|
||||
if ( ! is.active && isMonochron() )
|
||||
if ( ! flags.active && isMonochron() )
|
||||
setReverse(true); // Light background
|
||||
|
||||
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||
setBold();
|
||||
|
||||
for ( std::size_t z = 0
|
||||
; pos < center_offset + txtlength && z < getWidth() - 2
|
||||
; z++, pos++)
|
||||
{
|
||||
if ( z == hotkeypos && is.active )
|
||||
if ( z == hotkeypos && flags.active )
|
||||
{
|
||||
setColor (button_hotkey_fg, button_bg);
|
||||
|
||||
if ( ! is.active_focus && getMaxColor() < 16 )
|
||||
if ( ! active_focus && getMaxColor() < 16 )
|
||||
setBold();
|
||||
|
||||
if ( ! is.no_underline )
|
||||
if ( ! flags.no_underline )
|
||||
setUnderline();
|
||||
|
||||
print (button_text[z]);
|
||||
|
||||
if ( ! is.active_focus && getMaxColor() < 16 )
|
||||
if ( ! active_focus && getMaxColor() < 16 )
|
||||
unsetBold();
|
||||
|
||||
if ( ! is.no_underline )
|
||||
if ( ! flags.no_underline )
|
||||
unsetUnderline();
|
||||
|
||||
setColor (button_fg, button_bg);
|
||||
|
@ -718,7 +707,7 @@ inline void FButton::drawButtonTextLine (wchar_t button_text[])
|
|||
print (L"..");
|
||||
}
|
||||
|
||||
if ( is.active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||
if ( active_focus && (isMonochron() || getMaxColor() < 16) )
|
||||
unsetBold();
|
||||
|
||||
for (pos = center_offset + txtlength; pos < getWidth() - 2; pos++)
|
||||
|
@ -732,7 +721,7 @@ void FButton::draw()
|
|||
FWidget* parent_widget = getParentWidget();
|
||||
txtlength = text.getLength();
|
||||
space_char = int(' ');
|
||||
getButtonState();
|
||||
active_focus = flags.active && flags.focus;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -753,13 +742,13 @@ void FButton::draw()
|
|||
// Clear right margin after animation
|
||||
clearRightMargin (parent_widget);
|
||||
|
||||
if ( ! is.active && isMonochron() )
|
||||
if ( ! flags.active && isMonochron() )
|
||||
space_char = fc::MediumShade; // ▒ simulates greyed out at Monochron
|
||||
|
||||
if ( isMonochron() && (is.active || is.focus) )
|
||||
if ( isMonochron() && (flags.active || flags.focus) )
|
||||
setReverse(false); // Dark background
|
||||
|
||||
if ( is.flat && ! button_down )
|
||||
if ( flags.flat && ! button_down )
|
||||
drawFlatBorder();
|
||||
|
||||
hotkeypos = getHotkeyPos(text.wc_str(), button_text, uInt(txtlength));
|
||||
|
@ -785,7 +774,7 @@ void FButton::draw()
|
|||
drawTopBottomBackground();
|
||||
|
||||
// Draw button shadow
|
||||
if ( is.non_flat_shadow && ! button_down )
|
||||
if ( ! flags.flat && flags.shadow && ! button_down )
|
||||
drawShadow();
|
||||
|
||||
if ( isMonochron() )
|
||||
|
@ -798,7 +787,7 @@ void FButton::draw()
|
|||
//----------------------------------------------------------------------
|
||||
void FButton::updateStatusBar()
|
||||
{
|
||||
if ( ! is.focus || ! getStatusBar() )
|
||||
if ( ! flags.focus || ! getStatusBar() )
|
||||
return;
|
||||
|
||||
const FString& msg = getStatusbarMessage();
|
||||
|
|
|
@ -288,13 +288,13 @@ void FScrollView::setPrintPos (int x, int y)
|
|||
//----------------------------------------------------------------------
|
||||
bool FScrollView::setViewportPrint (bool on)
|
||||
{
|
||||
return use_own_print_area = ! on;
|
||||
return (use_own_print_area = ! on);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
bool FScrollView::setBorder (bool on)
|
||||
{
|
||||
return border = on;
|
||||
return (border = on);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -99,7 +99,7 @@ bool FStatusKey::setMouseFocus(bool on)
|
|||
if ( on == mouse_focus )
|
||||
return true;
|
||||
|
||||
return mouse_focus = on;
|
||||
return (mouse_focus = on);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -858,7 +858,7 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
|
|||
int xpos = x + tx;
|
||||
tc = &vterm->text[ypos * vterm->width + xpos];
|
||||
sc = generateCharacter(xpos, ypos);
|
||||
std::memcpy (tc, &sc, sizeof(charData));
|
||||
std::memcpy (tc, &sc, sizeof(sc));
|
||||
}
|
||||
|
||||
if ( short(vterm->changes[ypos].xmin) > x )
|
||||
|
@ -959,7 +959,7 @@ void FVTerm::updateOverlappedColor ( term_area* area
|
|||
charData* tc = &vterm->text[ty * vterm->width + tx];
|
||||
// New character
|
||||
charData nc;
|
||||
std::memcpy (&nc, ac, sizeof(charData));
|
||||
std::memcpy (&nc, ac, sizeof(*ac));
|
||||
// Overlapped character
|
||||
charData oc = getOverlappedCharacter (tx + 1, ty + 1, area->widget);
|
||||
nc.fg_color = oc.fg_color;
|
||||
|
@ -976,7 +976,7 @@ void FVTerm::updateOverlappedColor ( term_area* area
|
|||
nc.code = ' ';
|
||||
|
||||
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc);
|
||||
std::memcpy (tc, &nc, sizeof(charData));
|
||||
std::memcpy (tc, &nc, sizeof(nc));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -989,7 +989,7 @@ void FVTerm::updateOverlappedCharacter (term_area* area, int tx, int ty)
|
|||
// Overlapped character
|
||||
charData oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
|
||||
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc);
|
||||
std::memcpy (tc, &oc, sizeof(charData));
|
||||
std::memcpy (tc, &oc, sizeof(oc));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1021,7 +1021,7 @@ void FVTerm::updateShadedCharacter ( term_area* area
|
|||
oc.code = ' ';
|
||||
|
||||
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc);
|
||||
std::memcpy (tc, &oc, sizeof(charData));
|
||||
std::memcpy (tc, &oc, sizeof(oc));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1039,12 +1039,12 @@ void FVTerm::updateInheritBackground ( term_area* area
|
|||
charData* tc = &vterm->text[ty * vterm->width + tx];
|
||||
// New character
|
||||
charData nc;
|
||||
std::memcpy (&nc, ac, sizeof(charData));
|
||||
std::memcpy (&nc, ac, sizeof(*ac));
|
||||
// Covered character
|
||||
charData cc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
|
||||
nc.bg_color = cc.bg_color;
|
||||
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc);
|
||||
std::memcpy (tc, &nc, sizeof(charData));
|
||||
std::memcpy (tc, &nc, sizeof(nc));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1060,7 +1060,7 @@ void FVTerm::updateCharacter ( term_area* area
|
|||
charData* ac = &area->text[y * line_len + x];
|
||||
// Terminal character
|
||||
charData* tc = &vterm->text[ty * vterm->width + tx];
|
||||
std::memcpy (tc, ac, sizeof(charData));
|
||||
std::memcpy (tc, ac, sizeof(*ac));
|
||||
|
||||
if ( tc->attr.bit.printed && *tc == *ac )
|
||||
tc->attr.bit.no_changes = true;
|
||||
|
@ -1388,7 +1388,7 @@ void FVTerm::getArea (int ax, int ay, term_area* area)
|
|||
charData* ac; // area character
|
||||
tc = &vterm->text[(ay + y) * vterm->width + ax];
|
||||
ac = &area->text[y * area->width];
|
||||
std::memcpy (ac, tc, sizeof(charData) * unsigned(length));
|
||||
std::memcpy (ac, tc, sizeof(*tc) * unsigned(length));
|
||||
|
||||
if ( short(area->changes[y].xmin) > 0 )
|
||||
area->changes[y].xmin = 0;
|
||||
|
@ -1444,7 +1444,7 @@ void FVTerm::getArea (int x, int y, int w, int h, term_area* area)
|
|||
int line_len = area->width + area->right_shadow;
|
||||
tc = &vterm->text[(y + _y - 1) * vterm->width + x - 1];
|
||||
ac = &area->text[(dy + _y) * line_len + dx];
|
||||
std::memcpy (ac, tc, sizeof(charData) * unsigned(length));
|
||||
std::memcpy (ac, tc, sizeof(*tc) * unsigned(length));
|
||||
|
||||
if ( short(area->changes[dy + _y].xmin) > dx )
|
||||
area->changes[dy + _y].xmin = uInt(dx);
|
||||
|
@ -1572,14 +1572,14 @@ void FVTerm::scrollAreaForward (term_area* area)
|
|||
int pos2 = (y + 1) * total_width;
|
||||
sc = &area->text[pos2];
|
||||
dc = &area->text[pos1];
|
||||
std::memcpy (dc, sc, sizeof(charData) * unsigned(length));
|
||||
std::memcpy (dc, sc, sizeof(*sc) * unsigned(length));
|
||||
area->changes[y].xmin = 0;
|
||||
area->changes[y].xmax = uInt(area->width - 1);
|
||||
}
|
||||
|
||||
// insert a new line below
|
||||
lc = &area->text[(y_max * total_width) - area->right_shadow - 1];
|
||||
std::memcpy (&nc, lc, sizeof(charData));
|
||||
std::memcpy (&nc, lc, sizeof(*lc));
|
||||
nc.code = ' ';
|
||||
dc = &area->text[y_max * total_width];
|
||||
std::fill_n (dc, area->width, nc);
|
||||
|
@ -1633,14 +1633,14 @@ void FVTerm::scrollAreaReverse (term_area* area)
|
|||
int pos2 = y * total_width;
|
||||
sc = &area->text[pos1];
|
||||
dc = &area->text[pos2];
|
||||
std::memcpy (dc, sc, sizeof(charData) * unsigned(length));
|
||||
std::memcpy (dc, sc, sizeof(*sc) * unsigned(length));
|
||||
area->changes[y].xmin = 0;
|
||||
area->changes[y].xmax = uInt(area->width - 1);
|
||||
}
|
||||
|
||||
// insert a new line above
|
||||
lc = &area->text[total_width];
|
||||
std::memcpy (&nc, lc, sizeof(charData));
|
||||
std::memcpy (&nc, lc, sizeof(*lc));
|
||||
nc.code = ' ';
|
||||
dc = &area->text[0];
|
||||
std::fill_n (dc, area->width, nc);
|
||||
|
@ -1675,7 +1675,7 @@ void FVTerm::clearArea (term_area* area, int fillchar)
|
|||
uInt w;
|
||||
|
||||
// Current attributes with a space character
|
||||
std::memcpy (&nc, &next_attribute, sizeof(charData));
|
||||
std::memcpy (&nc, &next_attribute, sizeof(next_attribute));
|
||||
nc.code = fillchar;
|
||||
|
||||
if ( ! (area && area->text) )
|
||||
|
@ -1770,7 +1770,7 @@ FVTerm::charData FVTerm::generateCharacter (int x, int y)
|
|||
if ( tmp->attr.bit.trans_shadow ) // Transparent shadow
|
||||
{
|
||||
// Keep the current vterm character
|
||||
std::memcpy (&s_ch, sc, sizeof(charData));
|
||||
std::memcpy (&s_ch, sc, sizeof(*sc));
|
||||
s_ch.fg_color = tmp->fg_color;
|
||||
s_ch.bg_color = tmp->bg_color;
|
||||
s_ch.attr.bit.reverse = false;
|
||||
|
@ -1789,7 +1789,7 @@ FVTerm::charData FVTerm::generateCharacter (int x, int y)
|
|||
else if ( tmp->attr.bit.inherit_bg )
|
||||
{
|
||||
// Add the covered background to this character
|
||||
std::memcpy (&i_ch, tmp, sizeof(charData));
|
||||
std::memcpy (&i_ch, tmp, sizeof(*tmp));
|
||||
i_ch.bg_color = sc->bg_color; // Last background color
|
||||
sc = &i_ch;
|
||||
}
|
||||
|
@ -2007,7 +2007,7 @@ void FVTerm::init (bool disable_alt_screen)
|
|||
term_attribute.attr.byte[0] = 0;
|
||||
|
||||
// next_attribute contains the state of the next printed character
|
||||
std::memcpy (&next_attribute, &term_attribute, sizeof(charData));
|
||||
std::memcpy (&next_attribute, &term_attribute, sizeof(term_attribute));
|
||||
|
||||
// Receive the terminal capabilities
|
||||
tcap = FTermcap::getTermcapMap();
|
||||
|
@ -2086,7 +2086,7 @@ void FVTerm::putAreaLine (charData* ac, charData* tc, int length)
|
|||
{
|
||||
// copy "length" characters from area to terminal
|
||||
|
||||
std::memcpy (tc, ac, sizeof(charData) * unsigned(length));
|
||||
std::memcpy (tc, ac, sizeof(*ac) * unsigned(length));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -2099,7 +2099,7 @@ void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
|
|||
// Restore one character on vterm
|
||||
charData ch;
|
||||
ch = getCoveredCharacter (x, y, obj);
|
||||
std::memcpy (tc, &ch, sizeof(charData));
|
||||
std::memcpy (tc, &ch, sizeof(ch));
|
||||
}
|
||||
else // Mot transparent
|
||||
{
|
||||
|
@ -2121,19 +2121,19 @@ void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
|
|||
|| ch.code == fc::FullBlock )
|
||||
ch.code = ' ';
|
||||
|
||||
std::memcpy (tc, &ch, sizeof(charData));
|
||||
std::memcpy (tc, &ch, sizeof(ch));
|
||||
}
|
||||
else if ( ac->attr.bit.inherit_bg )
|
||||
{
|
||||
// Add the covered background to this character
|
||||
charData ch, cc;
|
||||
std::memcpy (&ch, ac, sizeof(charData));
|
||||
std::memcpy (&ch, ac, sizeof(*ac));
|
||||
cc = getCoveredCharacter (x, y, obj);
|
||||
ch.bg_color = cc.bg_color;
|
||||
std::memcpy (tc, &ch, sizeof(charData));
|
||||
std::memcpy (tc, &ch, sizeof(ch));
|
||||
}
|
||||
else // Default
|
||||
std::memcpy (tc, ac, sizeof(charData));
|
||||
std::memcpy (tc, ac, sizeof(*ac));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2153,7 +2153,7 @@ void FVTerm::getAreaCharacter ( int x, int y, term_area* area
|
|||
if ( tmp->attr.bit.trans_shadow ) // transparent shadow
|
||||
{
|
||||
// Keep the current vterm character
|
||||
std::memcpy (&s_ch, cc, sizeof(charData));
|
||||
std::memcpy (&s_ch, cc, sizeof(*cc));
|
||||
s_ch.fg_color = tmp->fg_color;
|
||||
s_ch.bg_color = tmp->bg_color;
|
||||
s_ch.attr.bit.reverse = false;
|
||||
|
@ -2163,7 +2163,7 @@ void FVTerm::getAreaCharacter ( int x, int y, term_area* area
|
|||
else if ( tmp->attr.bit.inherit_bg )
|
||||
{
|
||||
// Add the covered background to this character
|
||||
std::memcpy (&i_ch, tmp, sizeof(charData));
|
||||
std::memcpy (&i_ch, tmp, sizeof(*tmp));
|
||||
i_ch.bg_color = cc->bg_color; // last background color
|
||||
cc = &i_ch;
|
||||
}
|
||||
|
|
|
@ -61,10 +61,6 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
|
|||
, flags()
|
||||
, callback_objects()
|
||||
, member_callback_objects()
|
||||
, visible(true)
|
||||
, shown(false)
|
||||
, focusable(true)
|
||||
, visible_cursor(true)
|
||||
, widget_cursor_position(-1, -1)
|
||||
, size_hints()
|
||||
, double_flatline_mask()
|
||||
|
@ -85,10 +81,11 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
|
|||
// init bit field with 0
|
||||
memset (&flags, 0, sizeof(flags));
|
||||
|
||||
// Enable widget by default
|
||||
flags.active = true;
|
||||
|
||||
widget_object = true;
|
||||
flags.active = true; // Enable widget by default
|
||||
flags.visible = true; // A widget is visible by default
|
||||
flags.focusable = true; // A widget is focusable by default
|
||||
flags.visible_cursor = true; // A widget has a visible cursor by default
|
||||
widget_object = true; // This FObject is a widget
|
||||
|
||||
if ( ! parent )
|
||||
{
|
||||
|
@ -104,7 +101,7 @@ FWidget::FWidget (FWidget* parent, bool disable_alt_screen)
|
|||
}
|
||||
else
|
||||
{
|
||||
visible_cursor = ! hideable;
|
||||
flags.visible_cursor = ! hideable;
|
||||
offset = parent->client_offset;
|
||||
double_flatline_mask.top.resize (getWidth(), false);
|
||||
double_flatline_mask.right.resize (getHeight(), false);
|
||||
|
@ -671,7 +668,7 @@ bool FWidget::setCursorPos (int x, int y)
|
|||
|
||||
setAreaCursor ( widget_offsetX + x
|
||||
, widget_offsetY + y
|
||||
, visible_cursor
|
||||
, flags.visible_cursor
|
||||
, area );
|
||||
return true;
|
||||
}
|
||||
|
@ -1092,7 +1089,7 @@ void FWidget::show()
|
|||
}
|
||||
|
||||
draw();
|
||||
shown = true;
|
||||
flags.shown = true;
|
||||
|
||||
if ( hasChildren() )
|
||||
{
|
||||
|
@ -1129,8 +1126,8 @@ void FWidget::hide()
|
|||
{
|
||||
if ( isVisible() )
|
||||
{
|
||||
visible = false;
|
||||
shown = false;
|
||||
flags.visible = false;
|
||||
flags.shown = false;
|
||||
|
||||
if ( ! isDialogWidget()
|
||||
&& FWidget::getFocusWidget() == this
|
||||
|
@ -1966,7 +1963,7 @@ void FWidget::init()
|
|||
}
|
||||
|
||||
hideable = isCursorHideable();
|
||||
visible_cursor = ! hideable;
|
||||
flags.visible_cursor = ! hideable;
|
||||
|
||||
// Determine width and height of the terminal
|
||||
detectTermSize();
|
||||
|
|
|
@ -162,7 +162,7 @@ bool FWindow::activateWindow (bool on)
|
|||
active_area = getVWin();
|
||||
}
|
||||
|
||||
return window_active = on;
|
||||
return (window_active = on);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -141,7 +141,6 @@ class FButton : public FWidget
|
|||
|
||||
// Methods
|
||||
void init();
|
||||
void getButtonState();
|
||||
uChar getHotkey();
|
||||
void setHotkeyAccelerator();
|
||||
void detectHotkey();
|
||||
|
@ -160,6 +159,7 @@ class FButton : public FWidget
|
|||
// Data Members
|
||||
FString text;
|
||||
bool button_down;
|
||||
bool active_focus;
|
||||
bool click_animation;
|
||||
int click_time;
|
||||
int space_char;
|
||||
|
@ -175,17 +175,6 @@ class FButton : public FWidget
|
|||
short button_focus_bg;
|
||||
short button_inactive_fg;
|
||||
short button_inactive_bg;
|
||||
|
||||
struct state
|
||||
{
|
||||
uChar focus : 1;
|
||||
uChar active_focus : 1;
|
||||
uChar active : 1;
|
||||
uChar flat : 1;
|
||||
uChar non_flat_shadow : 1;
|
||||
uChar no_underline : 1;
|
||||
uChar : 2; // padding bits
|
||||
} is;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
@ -253,7 +242,7 @@ inline bool FButton::setUp()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FButton::setClickAnimation(bool on)
|
||||
{ return click_animation = on; }
|
||||
{ return (click_animation = on); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FButton::setClickAnimation()
|
||||
|
|
|
@ -479,7 +479,7 @@ inline void FListView::setUserDescendingCompare (Compare cmp)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListView::setTreeView (bool on)
|
||||
{ return tree_view = on; }
|
||||
{ return (tree_view = on); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FListView::setTreeView()
|
||||
|
|
|
@ -197,7 +197,7 @@ inline void FMessageBox::setTitlebarText (const FString& txt)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FMessageBox::setCenterText(bool on)
|
||||
{ return center_text = on; }
|
||||
{ return (center_text = on); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FMessageBox::setCenterText()
|
||||
|
|
|
@ -147,17 +147,21 @@ class FWidget : public FVTerm, public FObject
|
|||
uInt32 shadow : 1;
|
||||
uInt32 trans_shadow : 1;
|
||||
uInt32 active : 1;
|
||||
uInt32 visible : 1;
|
||||
uInt32 shown : 1;
|
||||
uInt32 focus : 1;
|
||||
uInt32 focusable : 1;
|
||||
uInt32 scrollable : 1;
|
||||
uInt32 resizeable : 1;
|
||||
uInt32 modal : 1;
|
||||
uInt32 visible_cursor : 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
|
||||
uInt32 : 15; // padding bits
|
||||
};
|
||||
|
||||
// Constructor
|
||||
|
@ -425,10 +429,6 @@ class FWidget : public FVTerm, public FObject
|
|||
static void setColorTheme();
|
||||
|
||||
// Data Members
|
||||
bool visible;
|
||||
bool shown;
|
||||
bool focusable;
|
||||
bool visible_cursor;
|
||||
FPoint widget_cursor_position;
|
||||
|
||||
struct widget_size_hints
|
||||
|
@ -734,7 +734,7 @@ inline void FWidget::setStatusbarMessage (const FString& msg)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setVisible()
|
||||
{ return visible = true; }
|
||||
{ return (flags.visible = true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setEnable()
|
||||
|
@ -750,7 +750,10 @@ inline bool FWidget::setDisable()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setVisibleCursor (bool on)
|
||||
{ return visible_cursor = ( on ) ? true : (( hideable ) ? false : true); }
|
||||
{
|
||||
flags.visible_cursor = ( on ) ? true : (( hideable ) ? false : true);
|
||||
return flags.visible_cursor;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::setVisibleCursor()
|
||||
|
@ -770,23 +773,23 @@ inline bool FWidget::unsetFocus()
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setFocusable()
|
||||
{ focusable = true; }
|
||||
{ flags.focusable = true; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::unsetFocusable()
|
||||
{ focusable = false; }
|
||||
{ flags.focusable = false; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::ignorePadding (bool on)
|
||||
{ return ignore_padding = on; }
|
||||
{ return (ignore_padding = on); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::ignorePadding()
|
||||
{ return ignore_padding = true; }
|
||||
{ return (ignore_padding = true); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::acceptPadding()
|
||||
{ return ignore_padding = false; }
|
||||
{ return (ignore_padding = false); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline void FWidget::setForegroundColor (short color)
|
||||
|
@ -881,11 +884,11 @@ inline bool FWidget::isRootWidget() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::isVisible() const
|
||||
{ return visible; }
|
||||
{ return flags.visible; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::isShown() const
|
||||
{ return shown; }
|
||||
{ return flags.shown; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::isWindowWidget() const
|
||||
|
@ -905,7 +908,7 @@ inline bool FWidget::isEnabled() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::hasVisibleCursor() const
|
||||
{ return visible_cursor; }
|
||||
{ return flags.visible_cursor; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::hasFocus() const
|
||||
|
@ -913,7 +916,7 @@ inline bool FWidget::hasFocus() const
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::acceptFocus() const // is focusable
|
||||
{ return focusable; }
|
||||
{ return flags.focusable; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
inline bool FWidget::isPaddingIgnored()
|
||||
|
|
Loading…
Reference in New Issue