how to minimize gui element?
-
- Posts: 156
- Joined: Wed Jul 21, 2004 4:29 am
- Location: Mishawaka, In
how to minimize gui element?
ok so if i have this nifty chatbox as a gui element, how would i go about minimizing it when im not using it or ignoring it or what ever so it isnt muckin up the scene?
by minimizing it i mean the entire tab control.
by minimizing it i mean the entire tab control.
-
- Posts: 156
- Joined: Wed Jul 21, 2004 4:29 am
- Location: Mishawaka, In
nevermind
nevermind all i have decided to go a different route with my interface lol but sugestions are still welcome as i may implement this in my new design in some manner.
-
- Posts: 156
- Joined: Wed Jul 21, 2004 4:29 am
- Location: Mishawaka, In
yea thats kinda what i thought
thats kinda what i was thinking but also to set up the interface so the tab contol would acculy be a pannel on either the left or right side of the screen then add all the buttons i need and make them children of the pannel that acculy open new windows as children of the buttons and further the parent/child hiarchy with the accual usable stuff inside the windows.
ov course in game play my project is going to require 3 completly differant
gui schemes. one for the online mmorpg part, one for the singleplayer part, and one for the fps parts when the player is at a space station or on a planet or ship,
basicly i am makeing an mmorpg with a singleplayer element that gets updates from the online world and effects new abilities and such in the online world. and the fps part is where instead of how most space mmorpgs are menu drivin when you go to a station you will accualy get to get off your ship and walk about doing things
ov course in game play my project is going to require 3 completly differant
gui schemes. one for the online mmorpg part, one for the singleplayer part, and one for the fps parts when the player is at a space station or on a planet or ship,
basicly i am makeing an mmorpg with a singleplayer element that gets updates from the online world and effects new abilities and such in the online world. and the fps part is where instead of how most space mmorpgs are menu drivin when you go to a station you will accualy get to get off your ship and walk about doing things
i'm not sure, but i thought that there is a minimize-function for the Windows...
yes, you have to create a button, but you don't have to code it... look at this:
Take a look at the API..
yes, you have to create a button, but you don't have to code it... look at this:
Code: Select all
IGUIWindow* window;
IGUIButton* closeButton;
closeButton=window->getMinimizeButton();
IrrLicht v0.14
Audiere Sounds-API v1.9.3
Current Project: KoulesXD
Audiere Sounds-API v1.9.3
Current Project: KoulesXD
The OnEvent handler of CGUIWindow doesn't do anything when you click either the minimize or restore buttons.
If you want all windows with minimize restore buttons to work, you will probably want to modify the code of CGUIWindow.h/cpp. Just handle the OnEvent when the minimize/restore/maximize button is clicked. You would need to keep track of the window size before and then restore it as appropriate. I can give some sample code.
If you only care to use it for you chat window, that same code would just go into your chat window OnEvent handler.
Travis
If you want all windows with minimize restore buttons to work, you will probably want to modify the code of CGUIWindow.h/cpp. Just handle the OnEvent when the minimize/restore/maximize button is clicked. You would need to keep track of the window size before and then restore it as appropriate. I can give some sample code.
If you only care to use it for you chat window, that same code would just go into your chat window OnEvent handler.
Travis
-
- Posts: 156
- Joined: Wed Jul 21, 2004 4:29 am
- Location: Mishawaka, In
that would be great
that would rock man im lost and that could atleast point me in the right direction.
Here are the diffs from the change that I made. All minimizing does is reduce the window to the title bar. If you try to reduce the width of the window it will hide the close, minimize and restore buttons. You could add some code to realign those buttons when the window is resized, but I didn't really care for that.
Code: Select all
==== //irrlicht/irrlicht_0.14.0/source/CGUIWindow.cpp#2 (text) ====
***************
*** 17,23 ****
//! constructor
CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
! : IGUIWindow(environment, parent, id, rectangle), Dragging(false)
{
#ifdef _DEBUG
setDebugName("CGUIWindow");
--- 17,23 ----
//! constructor
CGUIWindow::CGUIWindow(IGUIEnvironment* environment, IGUIElement* parent, s32 id, core::rect<s32> rectangle)
! : IGUIWindow(environment, parent, id, rectangle), Dragging(false), Minimized(false)
{
#ifdef _DEBUG
setDebugName("CGUIWindow");
***************
*** 80,85 ****
--- 80,117 ----
remove();
return true;
}
+ else
+ if (!Minimized && (event.GUIEvent.Caller == MinButton))
+ {
+ RestoreSize.Height = RelativeRect.getHeight();
+ RestoreSize.Width = RelativeRect.getWidth();
+
+ // calculate the new size to use
+ s32 buttonw = Environment->getSkin()->getSize(EGDS_WINDOW_BUTTON_WIDTH);
+
+ core::rect<s32> newPosition = RelativeRect;
+ newPosition.LowerRightCorner.Y
+ = newPosition.UpperLeftCorner.Y + buttonw + 7;
+
+ setRelativePosition(newPosition);
+
+ Minimized = true;
+ return true;
+ }
+ else
+ if (Minimized && (event.GUIEvent.Caller == RestoreButton))
+ {
+ core::rect<s32> newPosition = RelativeRect;
+ newPosition.LowerRightCorner.X
+ = newPosition.UpperLeftCorner.X + RestoreSize.Width;
+ newPosition.LowerRightCorner.Y
+ = newPosition.UpperLeftCorner.Y + RestoreSize.Height;
+
+ setRelativePosition(newPosition);
+
+ Minimized = false;
+ return true;
+ }
}
break;
case EET_MOUSE_INPUT_EVENT:
==== //irrlicht/irrlicht_0.14.0/source/CGUIWindow.h#2 (text) ====
***************
*** 43,48 ****
--- 43,51 ----
core::position2d<s32> DragStart;
bool Dragging;
+ core::dimension2d<s32> RestoreSize;
+ bool Minimized;
+
IGUIButton* CloseButton;
IGUIButton* MinButton;
IGUIButton* RestoreButton;