Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _NO_SPECIAL_ENTRY
- #include "src\YamiApplication.h"
- //#include "src\UI\UIButton.h"
- #include "src\Window\YWindow.h"
- #include "src\Window\Renderer.h"
- #include "src\Window\YTexture.h"
- #include "src\UI\UITextbox.h"
- #include "src\UI\UICheckbox.h"
- #include "src\UI\UITab.h"
- #include "src\UI\UITabControl.h"
- #include "src\FileManagement\Config\Config.h"
- using namespace Yami;
- using namespace Application;
- using namespace Files;
- using namespace UI;
- class MyForm : public YForm
- {
- private:
- YInt hkey = VK_HOME;
- UITextbox* tb1 = YObject::safe_alloc<UITextbox>();
- UICheckbox* cb1 = YObject::safe_alloc<UICheckbox>(), *cb2 = YObject::safe_alloc<UICheckbox>();
- YVector2 mouse;
- UITabControl* tabControl = YObject::safe_alloc<UITabControl>();
- UITab* tab1 = YObject::safe_alloc<UITab>(), *tab2 = YObject::safe_alloc<UITab>();
- public:
- YVoid InitalizeComponent()
- {
- _myWindow = YObject::safe_alloc<YWindow>();
- _myRenderer = YObject::safe_alloc<YRenderer>();
- _myWindow->Create(800, 600, 300, 300, "Class", "Title");
- _myRenderer->Create(_myWindow->gethWnd());
- _myRenderer->PrepareFont("Caviar", "Caviar Dreams", 25, 200);
- // Draw state
- cb1->setDrawState(YDraw_renderer);
- cb2->setDrawState(YDraw_renderer);
- tb1->setDrawState(YDraw_renderer);
- UIColor color;
- //Foreground
- color.foreground = D3DCOLOR_ARGB(255, 25, 25, 25);
- color.line = D3DCOLOR_ARGB(255, 40, 40, 40);
- color.text = D3DCOLOR_ARGB(255, 255, 255, 255);
- color.ex = D3DCOLOR_ARGB(255, 64, 64, 64);
- cb1->setDefaultColor(color);
- cb2->setDefaultColor(color);
- tb1->setDefaultColor(color);
- color.ex = D3DCOLOR_ARGB(245, 0, 157, 222);
- tabControl->setDefaultColor(color);
- color.line = D3DCOLOR_ARGB(255, 75, 75, 75);
- tabControl->setHoveredColor(color);
- //Hover
- cb1->setHoveredColor(color);
- cb2->setHoveredColor(color);
- tb1->setHoveredColor(color);
- cb1->setClickedColor(color);
- cb2->setClickedColor(color);
- // checkbox1
- cb1->setPadding({ 25, 150 });
- cb1->setSize({ 25, 25 });
- cb1->setName("Checkbox1");
- cb1->setText("Checkbox");
- cb1->setFont("Caviar");
- cb1->setEditable(true);
- // checkbox2
- cb2->setPadding({ 25, 150 });
- cb2->setSize({ 25, 25 });
- cb2->setName("Checkbox2");
- cb2->setText("Checkbox");
- cb2->setFont("Caviar");
- cb2->setEditable(true);
- // Textbox
- tb1->setPadding({ 25, 225 });
- tb1->setSize({ 0, 0 });
- tb1->setAutosize(true);
- tb1->setMultilined(true);
- tb1->setFont("Caviar");
- tb1->setText("Default Text");
- tb1->setName("Textbox1");
- // Tabs
- tab1->addChild(cb1);
- tab1->addChild(tb1);
- tab1->setFont("Caviar");
- tab1->setText("Tab1");
- tab2->addChild(cb2);
- tab2->setFont("Caviar");
- tab2->setText("Tab2");
- tabControl->setFont("Caviar");
- tabControl->setTabType(YTab_horiz);
- tabControl->setPadding({ 15, 15 });
- tabControl->setSize({ 75, 35 });
- tabControl->AddTab(tab1);
- tabControl->AddTab(tab2);
- _timer_tick = 5.0f;
- }
- YVoid Tick()
- {
- }
- YVoid DestroyComponent()
- {
- YObject::safe_delete(_myWindow);
- YObject::safe_delete(_myRenderer);
- YObject::safe_delete(cb1);
- YObject::safe_delete(cb2);
- YObject::safe_delete(tb1);
- YObject::safe_delete(tabControl);
- YObject::safe_delete(tab1);
- YObject::safe_delete(tab2);
- }
- YVoid OnResetDevice()
- {
- _myRenderer->getFontData("Caviar")->OnResetDevice();
- }
- YVoid OnLostDevice()
- {
- _myRenderer->getFontData("Caviar")->OnLostDevice();
- }
- YVoid OnMouseMove(YInt x, YInt y)
- {
- tabControl->OnMouseMove(x, y);
- }
- YVoid OnLeftMouseDown(YInt x, YInt y)
- {
- tabControl->OnLeftMouseDown(x, y);
- }
- YVoid OnLeftMouseUp(YInt x, YInt y)
- {
- tabControl->OnLeftMouseUp(x, y);
- }
- YVoid OnKeyDown(YInt i)
- {
- tabControl->OnKeyDown(i);
- }
- YVoid OnKeyUp(YInt i)
- {
- tabControl->OnKeyUp(i);
- }
- YVoid Render()
- {
- if (!IShouldRender())
- return;
- _myRenderer->Rect(0, 0, _myWindow->getWidth(), _myWindow->getHeigth(), D3DCOLOR_ARGB(255, 24, 24, 24));
- tabControl->Draw(_myRenderer);
- }
- };
- int main(int argC, char* argV[])
- {
- YApplication* app = Start(argC, argV);
- app->ApplicationRunForm(new MyForm());
- return app->Exit();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement