mwcxx/test.cxx

47 lines
938 B
C++
Raw Normal View History

2026-04-17 19:42:14 +09:00
#include <MwCXX/Core.h>
#include <MwCXX/Widget/Window.h>
#include <MwCXX/Widget/Button.h>
2026-04-18 01:05:20 +09:00
#include <MwCXX/Dialog/MessageBox.h>
2026-04-17 19:42:14 +09:00
#include <iostream>
class MyButton : public MwCXX::Button {
2026-04-17 21:26:28 +09:00
protected:
void OnActivate() {
std::cout << "Hello" << std::endl;
2026-04-18 01:05:20 +09:00
2026-04-18 01:06:20 +09:00
MwCXX::MessageBox(this->GetParent(), "Hello", "Hello world", MwMB_BUTTONOK | MwMB_ICONNEWS);
2026-04-17 21:26:28 +09:00
}
public:
MWCXX_CONSTRUCTOR(MyButton, MwCXX::Button) {
this->SetText("Hello, world!");
}
2026-04-17 19:42:14 +09:00
};
class MyWindow : public MwCXX::Window {
2026-04-17 21:26:28 +09:00
private:
MyButton* epic;
2026-04-17 19:42:14 +09:00
2026-04-17 22:44:19 +09:00
protected:
void OnResize() {
MwRect rc = this->GetArea();
this->epic->Resize(rc.width - 20, rc.height - 20);
}
2026-04-17 21:26:28 +09:00
public:
MWCXX_CONSTRUCTOR(MyWindow, MwCXX::Window) {
this->epic = new MyButton("epic app", this, 10, 10, 640 - 10 * 2, 480 - 10 * 2);
}
2026-04-17 19:42:14 +09:00
};
int main() {
MyWindow* wnd;
MwCXX::Init();
wnd = new MyWindow("epic app", NULL, MwDEFAULT, MwDEFAULT, 640, 480);
wnd->Loop();
}