Transfer some more code from GuiView to TabWorkArea.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20807 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-10-07 08:12:20 +00:00
parent 769185bc90
commit 0f67ab46b7
3 changed files with 13 additions and 6 deletions

View File

@ -264,12 +264,7 @@ GuiViewBase::~GuiViewBase()
void GuiViewBase::close() void GuiViewBase::close()
{ {
quitting_by_menu_ = true; quitting_by_menu_ = true;
while (d.tab_widget_->count()) { d.tab_widget_->closeAll();
GuiWorkArea * wa = dynamic_cast<GuiWorkArea *>(d.tab_widget_->widget(0));
BOOST_ASSERT(wa);
d.tab_widget_->removeTab(0);
delete wa;
}
QMainWindow::close(); QMainWindow::close();
quitting_by_menu_ = false; quitting_by_menu_ = false;
} }

View File

@ -728,6 +728,17 @@ void TabWorkArea::showBar(bool show)
} }
void TabWorkArea::closeAll()
{
while (count()) {
GuiWorkArea * wa = dynamic_cast<GuiWorkArea *>(widget(0));
BOOST_ASSERT(wa);
removeTab(0);
delete wa;
}
}
bool TabWorkArea::setCurrentWorkArea(GuiWorkArea * work_area) bool TabWorkArea::setCurrentWorkArea(GuiWorkArea * work_area)
{ {
BOOST_ASSERT(work_area); BOOST_ASSERT(work_area);

View File

@ -180,6 +180,7 @@ class TabWorkArea : public QTabWidget
public: public:
TabWorkArea(QWidget * parent = 0); TabWorkArea(QWidget * parent = 0);
void showBar(bool show); void showBar(bool show);
void closeAll();
bool setCurrentWorkArea(GuiWorkArea *); bool setCurrentWorkArea(GuiWorkArea *);
bool removeWorkArea(GuiWorkArea *); bool removeWorkArea(GuiWorkArea *);