Add zwidget
This commit is contained in:
parent
b30f1abe25
commit
b2d2f61be0
54 changed files with 9321 additions and 0 deletions
40
libraries/ZWidget/src/widgets/mainwindow/mainwindow.cpp
Normal file
40
libraries/ZWidget/src/widgets/mainwindow/mainwindow.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
#include "widgets/mainwindow/mainwindow.h"
|
||||
#include "widgets/menubar/menubar.h"
|
||||
#include "widgets/toolbar/toolbar.h"
|
||||
#include "widgets/statusbar/statusbar.h"
|
||||
|
||||
MainWindow::MainWindow() : Widget(nullptr, WidgetType::Window)
|
||||
{
|
||||
MenubarWidget = new Menubar(this);
|
||||
// ToolbarWidget = new Toolbar(this);
|
||||
StatusbarWidget = new Statusbar(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::SetCentralWidget(Widget* widget)
|
||||
{
|
||||
if (CentralWidget != widget)
|
||||
{
|
||||
delete CentralWidget;
|
||||
CentralWidget = widget;
|
||||
if (CentralWidget)
|
||||
CentralWidget->SetParent(this);
|
||||
OnGeometryChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::OnGeometryChanged()
|
||||
{
|
||||
Size s = GetSize();
|
||||
|
||||
MenubarWidget->SetFrameGeometry(0.0, 0.0, s.width, 32.0);
|
||||
// ToolbarWidget->SetFrameGeometry(0.0, 32.0, s.width, 36.0);
|
||||
StatusbarWidget->SetFrameGeometry(0.0, s.height - 32.0, s.width, 32.0);
|
||||
|
||||
if (CentralWidget)
|
||||
CentralWidget->SetFrameGeometry(0.0, 32.0, s.width, s.height - 32.0 - 32.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue