History: MyGUI addButtonInWindowSkin
Source of version: 4 (current)
Copy to clipboard
__Original window skin:__
{CODE(wrap="1", colors="xml")} ...
<Child type="Button" skin="WindowCaption" offset = "3 0 -6 30" align = "HStretch Top" name = "Caption">
<Property key="Scale" value = "1 1 0 0"/>
</Child>
<Child type="Button" skin="WindowX" offset = "-3 0 24 30" align = "Right Top" name = "Button">
<Property key="Event" value = "close"/>
</Child>
...{CODE}
__New window skin:__
{CODE(wrap="1", colors="xml")} ...
<Child type="Button" skin="WindowCaption" offset = "3 0 -54 30" align = "HStretch Top" name = "Caption">
<Property key="Scale" value = "1 1 0 0"/>
</Child>
<Child type="Button" skin="WindowX" offset = "-3 0 24 30" align = "Right Top" name = "Button">
<Property key="Event" value = "close"/>
</Child>
<Child type="Button" skin="WindowX" offset = "-27 0 24 30" align = "Right Top" name = "Button">
<Property key="Event" value = "minimized"/>
</Child>
<Child type="Button" skin="WindowX" offset = "-51 0 24 30" align = "Right Top" name = "Button">
<Property key="Event" value = "maximized"/>
</Child>
...{CODE}
__Create window:__
{CODE(wrap="1", colors="c++")} MyGUI::WindowPtr window = MyGUI::Gui::getInstance().createWidget<MyGUI::Window>("WindowCSX", x, y, 390, 300, MyGUI::Align::Default, "Overlapped");
window->eventWindowButtonPressed += MyGUI::newDelegate(this, &DemoKeeper::notifyWindowPressed);{CODE}
__Event:__
{CODE(wrap="1", colors="c++")} void DemoKeeper::notifyWindowPressed(MyGUI::Window* _widget, const std::string& _name)
{
MyGUI::WindowPtr window = _widget->castType<MyGUI::Window>();
if (_name == "close") window->destroySmooth();
else if (_name == "minimized") {
// hide window and show button in your taskbar
}
else if (_name == "maximized") {
// maximized window
}
}{CODE}