things
This commit is contained in:
parent
04c4e319c5
commit
f999d41064
3 changed files with 7 additions and 5 deletions
53
test.cc
Normal file
53
test.cc
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
#include <MwCXX/Core.h>
|
||||
#include <MwCXX/Widget/Window.h>
|
||||
#include <MwCXX/Widget/Button.h>
|
||||
#include <MwCXX/Dialog/MessageBox.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
static void close_msg(MwCXX::Button* button){
|
||||
delete button->GetParent();
|
||||
}
|
||||
|
||||
class MyButton : public MwCXX::Button {
|
||||
protected:
|
||||
void OnActivate() {
|
||||
MwCXX::Window* msg;
|
||||
|
||||
msg = MwCXX::MessageBox(this->GetParent(), "Hello", "Hello world", MwMB_BUTTONOK | MwMB_ICONNEWS);
|
||||
|
||||
MwCXX::MessageBoxGetChild(msg, MwMB_BUTTONOK)->ActivateHandler = close_msg;
|
||||
}
|
||||
|
||||
public:
|
||||
MWCXX_CONSTRUCTOR(MyButton, MwCXX::Button) {
|
||||
this->SetText("Hello, world!");
|
||||
}
|
||||
};
|
||||
|
||||
class MyWindow : public MwCXX::Window {
|
||||
private:
|
||||
MyButton* epic;
|
||||
|
||||
protected:
|
||||
void OnResize() {
|
||||
MwRect rc = this->GetArea();
|
||||
|
||||
this->epic->Resize(rc.width - 20, rc.height - 20);
|
||||
}
|
||||
|
||||
public:
|
||||
MWCXX_CONSTRUCTOR(MyWindow, MwCXX::Window) {
|
||||
this->epic = new MyButton("epic app", this, 10, 10, 640 - 10 * 2, 480 - 10 * 2);
|
||||
}
|
||||
};
|
||||
|
||||
int main() {
|
||||
MyWindow* wnd;
|
||||
|
||||
MwCXX::Init();
|
||||
|
||||
wnd = new MyWindow("epic app", NULL, MwDEFAULT, MwDEFAULT, 640, 480);
|
||||
|
||||
wnd->Loop();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue