FStatusBar and FMenuBar use now the always-on-top window option

This commit is contained in:
Markus Gans 2016-10-02 21:26:25 +02:00
parent 9ccc5a4f27
commit 1231b9f65d
15 changed files with 173 additions and 276 deletions

View File

@ -1,3 +1,7 @@
2016-10-02 Markus Gans <guru.mail@muenster.de>
* FStatusBar and FMenuBar use now the always-on-top
window option
2016-10-01 Markus Gans <guru.mail@muenster.de>
* Add an always-on-top mode for window objects
* New FToolTip widget to show assisted information

View File

@ -154,7 +154,7 @@ Class digramm
│ FTerm │◄─┘ : : ├────┤ FProgressbar │ └──┤ FSwitch ├-------:
└┬─┬─┬──┘ : : │ └──────────────┘ └─────────┘ :
:1:1:1 : : │ ┌────────────┐ : *┌─────────┐
: : └----------: : ├────┤ FScrollbar │ ├---┤ FString │
: : └---------- : ├────┤ FScrollbar │ ├---┤ FString │
: :1 : : │ └────────────┘ : └─────────┘
:┌┴──────────┐ : : │ ┌───────────┐1 :
:│ FOptiAttr │ : : ├────┤ FTextView ├---------------------------:
@ -169,13 +169,16 @@ Class digramm
: : │ ┌─────────────┐1 :
: : ┌───┴─────┐ ┌─────────┐ ┌──┤ FFileDialog ├----:
: : │ FWindow │◄─┤ FDialog │◄──┤ └─────────────┘ :
: : └───┬─────┘ └────┬────┘ │ ┌─────────────┐1 :
: : ▲ 1: └──┤ FMessageBox ├----:
: : │ : └─────────────┘ :
: : │ └------------------------------:
: : └───────────────┐ ┌──────────┐ :
: : │ ┌───┤ FMenuBar │ :
: : ┌───────────┐ └─────┤ └──────────┘ :
: : └──┬──┬───┘ └────┬────┘ │ ┌─────────────┐1 :
: : ▲ ▲ 1: └──┤ FMessageBox ├----:
: : │ │ : └─────────────┘ :
: : │ │ └------------------------------:
: : │ │ ┌──────────┐ :
: : │ └──────┤ FToolTip │ :
: : │ └──────────┘ :
: : └───────────────┐ ┌──────────┐ :
: : │ ┌───┤ FMenuBar │ :
: : ┌───────────┐ └──────┤ └──────────┘ :
: : │ FMenuList │◄──────────┤ ┌───────┐ :
: : └────┬──────┘ └───┤ FMenu │◄──┐ :
: : : └───────┘ │ :
@ -191,7 +194,7 @@ Class digramm
: : └---------------------------------------┘ :
: └---------------------------------------------------┘
: *┌────────┐
:---┤ FPoint │
---┤ FPoint │
: └────────┘
: *┌───────┐
└---┤ FRect │

View File

@ -781,7 +781,13 @@ bool FApplication::processDialogSwitchAccelerator()
if ( s > 0 && s >= n )
{
// unset the move/size mode
move_size_widget = 0;
if ( move_size_widget )
{
FWidget* w = move_size_widget;
move_size_widget = 0;
w->redraw();
}
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
sendEvent (dialog_list->at(n-1), &a_ev);
return true;
@ -812,7 +818,13 @@ bool FApplication::processAccelerator (FWidget*& widget)
if ( iter->key == key )
{
// unset the move/size mode
move_size_widget = 0;
if ( move_size_widget )
{
FWidget* w = move_size_widget;
move_size_widget = 0;
w->redraw();
}
FAccelEvent a_ev (fc::Accelerator_Event, focus_widget);
sendEvent (iter->object, &a_ev);
accpt = a_ev.isAccepted();

View File

@ -73,16 +73,7 @@ FDialog::~FDialog() // destructor
restoreVTerm (t_geometry);
}
if ( vwin != 0 )
{
if ( vwin->changes != 0 )
delete[] vwin->changes;
if ( vwin->text != 0 )
delete[] vwin->text;
delete vwin;
}
removeArea (vwin);
if ( isModal() )
unsetModal();
@ -105,10 +96,8 @@ void FDialog::init()
createArea (vwin);
addDialog(this);
addWindow(this);
alwaysOnTop();
setActiveWindow(this);
setTransparentShadow();
setForegroundColor (wc.dialog_fg);
setBackgroundColor (wc.dialog_bg);

View File

@ -108,7 +108,6 @@ void FMenu::init(FWidget* parent)
setGeometry (1, 1, 10, 2, false); // initialize geometry values
setTransparentShadow();
addWindow(this);
alwaysOnTop();
hide();
setForegroundColor (wc.menu_active_fg);

View File

@ -22,18 +22,9 @@ FMenuBar::FMenuBar(FWidget* parent)
//----------------------------------------------------------------------
FMenuBar::~FMenuBar()
{
if ( vmenubar != 0 )
{
if ( vmenubar->changes != 0 )
delete[] vmenubar->changes;
if ( vmenubar->text != 0 )
delete[] vmenubar->text;
delete vmenubar;
}
vmenubar = 0;
delWindow(this);
removeArea (vwin);
setMenuBar(0);
}
@ -45,10 +36,11 @@ void FMenuBar::init()
int w = r->getWidth();
// initialize geometry values
setGeometry (1, 1, w, 1, false);
createArea (vmenubar);
vmenubar->visible = true;
ignorePadding();
createArea (vwin);
setAlwaysOnTop();
addWindow(this);
setMenuBar(this);
ignorePadding();
if ( getRootWidget() )
getRootWidget()->setTopPadding(1, true);
@ -376,7 +368,7 @@ void FMenuBar::drawItems()
if ( x < screenWidth )
{
x++;
print (vmenubar, ' ');
print (' ');
}
txt = (*iter)->getText();
@ -421,7 +413,7 @@ void FMenuBar::drawItems()
if ( ! is_noUnderline )
setUnderline();
print (vmenubar, item_text[z]);
print (item_text[z]);
if ( ! is_noUnderline )
unsetUnderline();
@ -429,7 +421,7 @@ void FMenuBar::drawItems()
setColor();
}
else
print (vmenubar, item_text[z]);
print (item_text[z]);
}
if ( x > screenWidth+1 )
@ -437,19 +429,19 @@ void FMenuBar::drawItems()
if ( startpos < screenWidth )
{
printPos (screenWidth - 1, 1);
print (vmenubar, "..");
print ("..");
}
else if ( startpos-1 <= screenWidth )
{
printPos (screenWidth, 1);
print (vmenubar, ' ');
print (' ');
}
}
if ( x < screenWidth )
{
x++;
print (vmenubar, ' ');
print (' ');
}
setColor (wc.menu_active_fg, wc.menu_active_bg);
@ -462,7 +454,7 @@ void FMenuBar::drawItems()
}
for (; x <= screenWidth; x++)
print (vmenubar, ' ');
print (' ');
if ( isMonochron() )
setReverse(false);
@ -924,7 +916,7 @@ void FMenuBar::hide()
memset(blank, ' ', uLong(screenWidth));
blank[screenWidth] = '\0';
printPos (1,1);
print (vmenubar, blank);
print (blank);
delete[] blank;
}

View File

@ -158,18 +158,7 @@ FStatusBar::FStatusBar(FWidget* parent)
//----------------------------------------------------------------------
FStatusBar::~FStatusBar()
{
if ( vstatusbar != 0 )
{
if ( vstatusbar->changes != 0 )
delete[] vstatusbar->changes;
if ( vstatusbar->text != 0 )
delete[] vstatusbar->text;
delete vstatusbar;
}
vstatusbar = 0;
delWindow(this);
// delete all keys
if ( ! keylist.empty() )
@ -184,6 +173,8 @@ FStatusBar::~FStatusBar()
iter = keylist.erase(iter);
}
}
removeArea (vwin);
setStatusBar(0);
}
@ -197,14 +188,13 @@ void FStatusBar::init()
int h = r->getHeight();
// initialize geometry values
setGeometry (1, h, w, 1, false);
createArea (vstatusbar);
vstatusbar->visible = true;
createArea (vwin);
setAlwaysOnTop();
addWindow(this);
setStatusBar(this);
ignorePadding();
mouse_down = false;
setStatusBar(this);
if ( getRootWidget() )
getRootWidget()->setBottomPadding(1, true);
@ -226,9 +216,6 @@ void FStatusBar::drawKeys()
std::vector<FStatusKey*>::const_iterator iter, end;
int screenWidth;
if ( ! vstatusbar )
return;
screenWidth = getColumnNumber();
x = 1;
@ -262,27 +249,26 @@ void FStatusBar::drawKeys()
setColor ( wc.statusbar_active_hotkey_fg
, wc.statusbar_active_hotkey_bg );
x++;
print (vstatusbar, ' ');
print (' ');
x += kname_len;
print (vstatusbar, getKeyName((*iter)->getKey()));
print (getKeyName((*iter)->getKey()));
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
x++;
print (vstatusbar, '-');
print ('-');
txt_length = int((*iter)->getText().getLength());
x += txt_length;
if ( x <= screenWidth )
{
print (vstatusbar, (*iter)->getText());
print ((*iter)->getText());
x++;
print (vstatusbar, fc::RightHalfBlock); // ▌
print (fc::RightHalfBlock); // ▌
}
else
{
print ( vstatusbar
, (*iter)->getText()
print ( (*iter)->getText()
.left(uInt(txt_length+screenWidth-x-1)) );
print (vstatusbar, "..");
print ("..");
}
if ( isMonochron() )
@ -295,23 +281,22 @@ void FStatusBar::drawKeys()
// not active
setColor (wc.statusbar_hotkey_fg, wc.statusbar_hotkey_bg);
x++;
print (vstatusbar, ' ');
print (' ');
x += kname_len;
print (vstatusbar, getKeyName((*iter)->getKey()));
print (getKeyName((*iter)->getKey()));
setColor (wc.statusbar_fg, wc.statusbar_bg);
x++;
print (vstatusbar, '-');
print ('-');
txt_length = int((*iter)->getText().getLength());
x += txt_length;
if ( x-1 <= screenWidth )
print (vstatusbar, (*iter)->getText());
print ((*iter)->getText());
else
{
print ( vstatusbar
, (*iter)->getText()
print ( (*iter)->getText()
.left(uInt(txt_length+screenWidth-x-1)) );
print ( vstatusbar, ".." );
print ("..");
}
if ( iter+1 != keylist.end()
@ -325,7 +310,7 @@ void FStatusBar::drawKeys()
setColor (wc.statusbar_active_fg, wc.statusbar_active_bg);
x++;
print (vstatusbar, fc::LeftHalfBlock); // ▐
print (fc::LeftHalfBlock); // ▐
if ( isMonochron() )
setReverse(true);
@ -335,7 +320,7 @@ void FStatusBar::drawKeys()
// not the last element
setColor (wc.statusbar_separator_fg, wc.statusbar_bg);
x++;
print (vstatusbar, fc::BoxDrawingsVertical); // │
print (fc::BoxDrawingsVertical); // │
}
}
}
@ -344,7 +329,7 @@ void FStatusBar::drawKeys()
setColor (wc.statusbar_fg, wc.statusbar_bg);
for (; x <= screenWidth; x++)
print (vstatusbar, ' ');
print (' ');
}
++iter;
}
@ -377,7 +362,7 @@ void FStatusBar::hide()
memset(blank, ' ', uLong(screenWidth));
blank[screenWidth] = '\0';
printPos (1, 1);
print (vstatusbar, blank);
print (blank);
delete[] blank;
}
//----------------------------------------------------------------------
@ -578,7 +563,7 @@ void FStatusBar::drawMessage()
int termWidth, space_offset;
bool isLastActiveFocus, hasKeys;
if ( ! (isVisible() && vstatusbar) )
if ( ! (isVisible() ) )
return;
if ( x < 0 || x_msg < 0 )
@ -615,32 +600,31 @@ void FStatusBar::drawMessage()
if ( ! isLastActiveFocus )
{
x++;
print (vstatusbar, ' ');
print (' ');
}
if ( hasKeys )
{
x += 2;
print (vstatusbar, fc::BoxDrawingsVertical); // │
print (vstatusbar, ' ');
print (fc::BoxDrawingsVertical); // │
print (' ');
}
int msg_length = int(getMessage().getLength());
x += msg_length;
if ( x-1 <= termWidth )
print (vstatusbar, getMessage());
print (getMessage());
else
{
print ( vstatusbar
, getMessage().left(uInt(msg_length+termWidth-x-1)) );
print (vstatusbar, "..");
print ( getMessage().left(uInt(msg_length+termWidth-x-1)) );
print ("..");
}
}
}
for (int i=x; i <= termWidth; i++)
print (vstatusbar, ' ');
print (' ');
if ( isMonochron() )
setReverse(false);

View File

@ -100,8 +100,6 @@ FOptiAttr* FTerm::opti_attr = 0;
FTerm::modifier_key FTerm::mod_key;
FTerm::term_area* FTerm::vterm = 0;
FTerm::term_area* FTerm::vdesktop = 0;
FTerm::term_area* FTerm::vmenubar = 0;
FTerm::term_area* FTerm::vstatusbar = 0;
FTerm::term_area* FTerm::last_area = 0;
std::queue<int>* FTerm::output_buffer = 0;
std::map<uChar,uChar>* FTerm::vt100_alt_char = 0;
@ -134,8 +132,6 @@ FTerm::FTerm()
fd_tty = -1;
vterm = 0;
vdesktop = 0;
vmenubar = 0;
vstatusbar = 0;
last_area = 0;
x_term_pos = -1;
y_term_pos = -1;
@ -2141,33 +2137,8 @@ void FTerm::finish()
if ( xterm_font )
delete xterm_font;
if ( vdesktop != 0 )
{
if ( vdesktop->changes != 0 )
delete[] vdesktop->changes;
if ( vdesktop->text != 0 )
delete[] vdesktop->text;
delete vdesktop;
}
if ( vterm != 0 )
{
if ( vterm->changes != 0 )
{
delete[] vterm->changes;
vterm->changes = 0;
}
if ( vterm->text != 0 )
{
delete[] vterm->text;
vterm->text = 0;
}
delete vterm;
}
removeArea (vdesktop);
removeArea (vterm);
}
//----------------------------------------------------------------------
@ -2265,8 +2236,10 @@ void FTerm::resizeArea (term_area* area)
{
if ( area->changes != 0 )
delete[] area->changes;
if ( area->text != 0 )
delete[] area->text;
area->changes = new line_changes[height + bsh];
area->text = new FOptiAttr::char_data[area_size];
}
@ -2274,6 +2247,7 @@ void FTerm::resizeArea (term_area* area)
{
if ( area->text != 0 )
delete[] area->text;
area->text = new FOptiAttr::char_data[area_size];
}
else
@ -2313,6 +2287,29 @@ void FTerm::resizeArea (term_area* area)
std::fill_n (area->changes, height+bsh, unchanged);
}
//----------------------------------------------------------------------
void FTerm::removeArea (term_area*& area)
{
// remove the virtual window
if ( area != 0 )
{
if ( area->changes != 0 )
{
delete[] area->changes;
area->changes = 0;
}
if ( area->text != 0 )
{
delete[] area->text;
area->text = 0;
}
delete area;
area = 0;
}
}
//----------------------------------------------------------------------
void FTerm::restoreVTerm (const FRect& box)
{
@ -2420,34 +2417,6 @@ void FTerm::restoreVTerm (int x, int y, int w, int h)
}
}
// menubar is always on top
FWidget* menubar;
menubar = reinterpret_cast<FWidget*>(FWidget::menuBar());
if ( vmenubar && menubar
&& menubar->getTermGeometry().contains(x+tx+1, y+ty+1) )
{
int bar_x = menubar->getTermX() - 1;
int bar_y = menubar->getTermY() - 1;
if ( vmenubar->visible )
sc = &vmenubar->text[(y+ty-bar_y) * vmenubar->width + (x+tx-bar_x)];
}
// statusbar is always on top
FWidget* statusbar;
statusbar = reinterpret_cast<FWidget*>(FWidget::statusBar());
if ( vstatusbar && statusbar
&& statusbar->getTermGeometry().contains(x+tx+1, y+ty+1) )
{
int bar_x = statusbar->getTermX() - 1;
int bar_y = statusbar->getTermY() - 1;
if ( vstatusbar->visible )
sc = &vstatusbar->text[(y+ty-bar_y) * vstatusbar->width + (x+tx-bar_x)];
}
memcpy (tc, sc, sizeof(FOptiAttr::char_data));
if ( short(vterm->changes[y+ty].xmin) > x )
@ -2516,34 +2485,6 @@ FTerm::covered_state FTerm::isCovered (int x, int y, FTerm::term_area* area) con
}
}
// menubar is always on top
FWidget* menubar;
if ( vmenubar )
menubar = reinterpret_cast<FWidget*>(vmenubar->widget);
else
menubar = 0;
if ( area != vmenubar && menubar
&& menubar->getTermGeometry().contains(x,y) )
{
is_covered = fully_covered;
}
// statusbar is always on top
FWidget* statusbar;
if ( vstatusbar )
statusbar = reinterpret_cast<FWidget*>(vstatusbar->widget);
else
statusbar = 0;
if ( area != vstatusbar && statusbar
&& statusbar->getTermGeometry().contains(x,y) )
{
is_covered = fully_covered;
}
return is_covered;
}
@ -2813,7 +2754,7 @@ void FTerm::putArea (const FPoint& pos, FTerm::term_area* area)
//----------------------------------------------------------------------
void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
{
int aw, ah, rsh, bsh, y_end, length, ol, sbar;
int aw, ah, rsh, bsh, y_end, length, ol;
FOptiAttr::char_data* tc; // terminal character
FOptiAttr::char_data* ac; // area character
@ -2830,7 +2771,6 @@ void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
rsh = area->right_shadow;
bsh = area->bottom_shadow;
ol = 0; // outside left
sbar = 0; // statusbar distance
if ( ax < 0 )
{
@ -2838,11 +2778,8 @@ void FTerm::putArea (int ax, int ay, FTerm::term_area* area)
ax = 0;
}
if ( vstatusbar && vstatusbar->widget && area != vstatusbar )
sbar = 1;
if ( ay + ah + bsh + sbar > vterm->height )
y_end = vterm->height - ay - sbar;
if ( ay + ah + bsh > vterm->height )
y_end = vterm->height - ay;
else
y_end = ah + bsh;

View File

@ -243,8 +243,6 @@ class FTerm
static term_area* vterm; // virtual terminal
static term_area* vdesktop; // virtual desktop
static term_area* vmenubar; // virtual menubar
static term_area* vstatusbar; // virtual statusbar
static term_area* last_area; // last used area
term_area* vwin; // virtual window
@ -292,6 +290,7 @@ class FTerm
static bool charEncodable (uInt);
void createArea (FTerm::term_area*&); // reference to pointer
void resizeArea (FTerm::term_area*);
void removeArea (FTerm::term_area*&); // reference to pointer
void restoreVTerm (const FRect&);
void restoreVTerm (int, int, int, int);
FTerm::covered_state isCovered (const FPoint&, FTerm::term_area*) const;

View File

@ -14,7 +14,10 @@
FToolTip::FToolTip (FWidget* parent)
: FWindow(parent)
, text()
, text_components(0)
, text_split()
, max_line_width(0)
, text_num_lines(0)
{
init();
}
@ -23,7 +26,10 @@ FToolTip::FToolTip (FWidget* parent)
FToolTip::FToolTip (const FString& txt, FWidget* parent)
: FWindow(parent)
, text(txt)
, text_components(0)
, text_split()
, max_line_width(0)
, text_num_lines(0)
{
init();
}
@ -35,10 +41,9 @@ FToolTip::~FToolTip() // destructor
if ( ! fapp->isQuit() )
{
FWidget* parent = getParentWidget();
FWindow* parent_win = 0;
if ( parent )
if ( FWidget* parent = getParentWidget() )
parent_win = getWindowWidget(parent);
if ( parent_win )
@ -55,16 +60,7 @@ FToolTip::~FToolTip() // destructor
restoreVTerm (t_geometry);
}
if ( vwin != 0 )
{
if ( vwin->changes != 0 )
delete[] vwin->changes;
if ( vwin->text != 0 )
delete[] vwin->text;
delete vwin;
}
removeArea (vwin);
}
@ -79,11 +75,8 @@ void FToolTip::init()
setMinimumSize (3, 3);
createArea (vwin);
addWindow(this);
alwaysOnTop();
setForegroundColor (wc.tooltip_fg);
setBackgroundColor (wc.tooltip_bg);
calculateDimensions();
}

View File

@ -96,8 +96,7 @@ FWidget::~FWidget() // destructor
// unset the local window widget focus
if ( focus )
{
FWindow* window = FWindow::getWindowWidget(this);
if ( window )
if ( FWindow* window = FWindow::getWindowWidget(this) )
window->setWindowFocusWidget(0);
}
@ -143,7 +142,7 @@ void FWidget::init()
foreground_color = wc.term_fg;
background_color = wc.term_bg;
setColor (foreground_color, background_color);
setColor();
clearArea();
accelerator_list = new Accelerators();
@ -502,12 +501,6 @@ void FWidget::adjustSizeGlobal()
return;
}
if ( menubar )
menubar->adjustSize();
if ( statusbar )
statusbar->adjustSize();
if ( window_list && ! window_list->empty() )
{
widgetList::const_iterator iter, end;
@ -1230,6 +1223,7 @@ void FWidget::redraw()
if ( isRootWidget() )
{
terminal_updates = false;
// clean desktop
setColor (wc.term_fg, wc.term_bg);
clearArea();
}
@ -1283,22 +1277,6 @@ void FWidget::redraw()
++iter;
}
}
if ( menubar && vmenubar )
{
int w = vmenubar->width;
int h = vmenubar->height;
std::fill_n (vmenubar->text, w * h, default_char);
menubar->redraw();
}
if ( statusbar && vstatusbar )
{
int w = vstatusbar->width;
int h = vstatusbar->height;
std::fill_n (vstatusbar->text, w * h, default_char);
statusbar->redraw();
}
}
else
{
@ -1344,23 +1322,6 @@ void FWidget::resize()
closeConsole();
resizeVTerm();
resizeArea (vdesktop);
if ( menubar )
{
menubar->setGeometry(1, 1, getWidth(), 1, false);
if ( vmenubar )
resizeArea(vmenubar);
}
if ( statusbar )
{
statusbar->setGeometry(1, getHeight(), getWidth(), 1, false);
if ( vstatusbar )
resizeArea(vstatusbar);
}
adjustSizeGlobal();
}
else

View File

@ -1235,6 +1235,7 @@ const wchar_t NF_Drive[5] =
fc::NF_shadow_box_right,
'\0'
};
const wchar_t NF_CD_ROM[5] =
{
fc::NF_shadow_box_left,
@ -1243,6 +1244,7 @@ const wchar_t NF_CD_ROM[5] =
fc::NF_shadow_box_right,
'\0'
};
const wchar_t NF_Net_Drive[5] =
{
fc::NF_shadow_box_left,
@ -1251,6 +1253,7 @@ const wchar_t NF_Net_Drive[5] =
fc::NF_shadow_box_right,
'\0'
};
const wchar_t CHECKBOX[4] =
{
fc::NF_shadow_box_left,
@ -1258,6 +1261,7 @@ const wchar_t CHECKBOX[4] =
fc::NF_shadow_box_right,
'\0'
};
const wchar_t CHECKBOX_ON[4] =
{
fc::NF_shadow_box_left,
@ -1265,6 +1269,7 @@ const wchar_t CHECKBOX_ON[4] =
fc::NF_shadow_box_right,
'\0'
};
const wchar_t RADIO_BUTTON[4] =
{
fc::NF_radio_button1,
@ -1272,6 +1277,7 @@ const wchar_t RADIO_BUTTON[4] =
fc::NF_radio_button3,
'\0'
};
const wchar_t CHECKED_RADIO_BUTTON[4] =
{
fc::NF_radio_button1,

View File

@ -59,6 +59,27 @@ void FWindow::deleteFromAlwaysOnTopList (FWidget* obj)
}
}
//----------------------------------------------------------------------
void FWindow::processAlwaysOnTop()
{
// Raise all always-on-top windows
if ( always_on_top_list && ! always_on_top_list->empty() )
{
widgetList::iterator iter;
iter = always_on_top_list->begin();
while ( iter != always_on_top_list->end() )
{
delWindow (*iter);
if ( window_list )
window_list->push_back(*iter);
++iter;
}
}
}
// protected methods of FWindow
//----------------------------------------------------------------------
@ -221,6 +242,8 @@ void FWindow::addWindow (FWidget* obj)
// add the window object obj to the window list
if ( window_list )
window_list->push_back(obj);
processAlwaysOnTop();
}
//----------------------------------------------------------------------
@ -367,7 +390,7 @@ bool FWindow::raiseWindow (FWidget* obj)
window_list->push_back (obj);
FEvent ev(fc::WindowRaised_Event);
FApplication::sendEvent(obj, &ev);
alwaysOnTop();
processAlwaysOnTop();
return true;
}
@ -417,24 +440,6 @@ bool FWindow::lowerWindow (FWidget* obj)
return false;
}
//----------------------------------------------------------------------
void FWindow::alwaysOnTop()
{
// Raise all always-on-top windows
if ( always_on_top_list && ! always_on_top_list->empty() )
{
widgetList::iterator iter;
iter = always_on_top_list->begin();
while ( iter != always_on_top_list->end() )
{
delWindow (*iter);
addWindow (*iter);
++iter;
}
}
}
//----------------------------------------------------------------------
bool FWindow::zoomWindow()
{
@ -565,8 +570,11 @@ void FWindow::switchToPrevWindow()
--iter;
FWindow* w = static_cast<FWindow*>(*iter);
if ( w && w != active_window
&& ! (w->isHiddenWindow() || w->isActiveWindow()) )
if ( w
&& w != active_window
&& ! (w->isHiddenWindow() || w->isActiveWindow())
&& w != static_cast<FWindow*>(statusBar())
&& w != static_cast<FWindow*>(menuBar()) )
{
setActiveWindow(w);
break;
@ -599,13 +607,19 @@ bool FWindow::activatePrevWindow()
// activate the previous window
FWindow* w = previous_widget;
if ( w && ! (w->isHiddenWindow() || w->isActiveWindow()) )
if ( w )
{
setActiveWindow(w);
return true;
if ( w->isActiveWindow() )
return true;
if ( w && ! w->isHiddenWindow() )
{
setActiveWindow(w);
return true;
}
}
else
return false;
return false;
}
//----------------------------------------------------------------------

View File

@ -58,7 +58,8 @@ class FWindow : public FWidget
// Disable assignment operator (=)
FWindow& operator = (const FWindow&);
void deleteFromAlwaysOnTopList (FWidget*);
static void deleteFromAlwaysOnTopList (FWidget*);
static void processAlwaysOnTop();
protected:
// Event handlers
@ -96,7 +97,6 @@ class FWindow : public FWidget
bool raiseWindow ();
static bool lowerWindow (FWidget*);
bool lowerWindow ();
static void alwaysOnTop();
bool zoomWindow ();
bool isZoomed() const;
bool setWindowWidget (bool);

View File

@ -112,6 +112,8 @@ void Transparent::onKeyPress (FKeyEvent* ev)
else
ev->ignore();
}
else
FDialog::onKeyPress(ev);
}
@ -147,6 +149,8 @@ class MainWindow : public FDialog
close();
ev->accept();
}
else
FDialog::onKeyPress(ev);
}
public: