This commit is contained in:
Nishi 2026-04-18 19:46:26 +09:00
commit f999d41064
Signed by: nishi
GPG key ID: 27EF69B208EB9343
3 changed files with 7 additions and 5 deletions

View file

@ -1,53 +0,0 @@
#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();
}