diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/include/IGUISkin.h Irrlicht_starsonata/include/IGUISkin.h --- irrlicht-svn-ss/trunk/include/IGUISkin.h 2007-07-26 02:11:22.000000000 +0200 +++ Irrlicht_starsonata/include/IGUISkin.h 2008-06-04 06:23:28.000000000 +0200 @@ -320,6 +362,32 @@ namespace gui 0 }; + enum EGUI_HORIZONTAL_ALIGNMENT + { + //! Align a gui element to the left + EGHA_LEFT, + + //! Align a gui element to the right + EGHA_RIGHT, + + //! this value is not used, it only specifies the amount of default horizontal alignements + //! available. + EGHA_COUNT + }; + + enum EGUI_VERTICAL_ALIGNMENT + { + //! Align a gui element to the top + EGVA_TOP, + + //! Align a gui element to the bottom + EGVA_BOTTOM, + + //! this value is not used, it only specifies the amount of default vertical alignements + //! available. + EGVA_COUNT + }; + //! A skin modifies the look of the GUI elements. class IGUISkin : public virtual io::IAttributeExchangingObject { @@ -464,7 +542,7 @@ namespace gui \param rect: Defining area where to draw. \param clip: Clip area. */ virtual void draw3DTabButton(IGUIElement* element, bool active, - const core::rect& rect, const core::rect* clip=0) = 0; + const core::rect& rect, const core::rect* clip=0, EGUI_VERTICAL_ALIGNMENT alignment=EGVA_TOP) = 0; //! draws a tab control body /** \param element: Pointer to the element which wishes to draw this. This parameter @@ -473,9 +551,10 @@ namespace gui \param border: Specifies if the border should be drawn. \param background: Specifies if the background should be drawn. \param rect: Defining area where to draw. - \param clip: Clip area. */ + \param clip: Clip area. + \param tabHeight: Defines the height of the tabs.*/ virtual void draw3DTabBody(IGUIElement* element, bool border, bool background, - const core::rect& rect, const core::rect* clip=0) = 0; + const core::rect& rect, const core::rect* clip=0, s32 tabHeight=-1, EGUI_VERTICAL_ALIGNMENT alignment=EGVA_TOP ) = 0; //! draws an icon, usually from the skin's sprite bank /** \param element: Pointer to the element which wishes to draw this icon. diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CGUISkin.cpp Irrlicht_starsonata/source/Irrlicht/CGUISkin.cpp --- irrlicht-svn-ss/trunk/source/Irrlicht/CGUISkin.cpp 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CGUISkin.cpp 2008-06-04 06:50:56.000000000 +0200 @@ -660,13 +705,15 @@ implementations to find out how to draw \param rect: Defining area where to draw. \param clip: Clip area. */ void CGUISkin::draw3DTabButton(IGUIElement* element, bool active, - const core::rect& frameRect, const core::rect* clip) + const core::rect& frameRect, const core::rect* clip, EGUI_VERTICAL_ALIGNMENT alignment) { if (!Driver) return; core::rect tr = frameRect; + if ( alignment == EGVA_TOP ) + { tr.LowerRightCorner.X -= 2; tr.LowerRightCorner.Y = tr.UpperLeftCorner.Y + 1; tr.UpperLeftCorner.X += 1; @@ -694,6 +741,39 @@ void CGUISkin::draw3DTabButton(IGUIEleme tr.UpperLeftCorner.X += 1; tr.UpperLeftCorner.Y += 1; Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip); + } + else + { + tr.LowerRightCorner.X -= 2; + tr.UpperLeftCorner.Y = tr.LowerRightCorner.Y - 1; + tr.UpperLeftCorner.X += 1; + Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); + + // draw left highlight + tr = frameRect; + tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; + tr.LowerRightCorner.Y -= 1; + Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); + + // draw grey background + tr = frameRect; + tr.UpperLeftCorner.X += 1; + tr.UpperLeftCorner.Y -= 1; + tr.LowerRightCorner.X -= 2; + tr.LowerRightCorner.Y -= 1; + Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); + + // draw right middle gray shadow + tr.LowerRightCorner.X += 1; + tr.UpperLeftCorner.X = tr.LowerRightCorner.X - 1; + //tr.LowerRightCorner.Y -= 1; + Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); + + tr.LowerRightCorner.X += 1; + tr.UpperLeftCorner.X += 1; + tr.LowerRightCorner.Y -= 1; + Driver->draw2DRectangle(getColor(EGDC_3D_DARK_SHADOW), tr, clip); + } } @@ -706,18 +786,23 @@ implementations to find out how to draw \param rect: Defining area where to draw. \param clip: Clip area. */ void CGUISkin::draw3DTabBody(IGUIElement* element, bool border, bool background, - const core::rect& rect, const core::rect* clip) + const core::rect& rect, const core::rect* clip, s32 tabHeight, EGUI_VERTICAL_ALIGNMENT alignment) { if (!Driver) return; core::rect tr = rect; + if ( tabHeight == -1 ) + tabHeight = getSize(gui::EGDS_BUTTON_HEIGHT); + // draw border. if (border) { + if ( alignment == EGVA_TOP ) + { // draw left hightlight - tr.UpperLeftCorner.Y += getSize(gui::EGDS_BUTTON_HEIGHT) + 2; + tr.UpperLeftCorner.Y += tabHeight + 2; tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); @@ -731,14 +816,44 @@ void CGUISkin::draw3DTabBody(IGUIElement tr.UpperLeftCorner.Y = tr.LowerRightCorner.Y - 1; Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); } + else + { + // draw left hightlight + tr.LowerRightCorner.Y -= tabHeight + 2; + tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; + Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); + + // draw right shadow + tr.UpperLeftCorner.X = rect.LowerRightCorner.X - 1; + tr.LowerRightCorner.X = tr.UpperLeftCorner.X + 1; + Driver->draw2DRectangle(getColor(EGDC_3D_SHADOW), tr, clip); + + // draw lower shadow + tr = rect; + tr.LowerRightCorner.Y = tr.UpperLeftCorner.Y + 1; + Driver->draw2DRectangle(getColor(EGDC_3D_HIGH_LIGHT), tr, clip); + } + } if (background) { + if ( alignment == EGVA_TOP ) + { tr = rect; - tr.UpperLeftCorner.Y += getSize(gui::EGDS_BUTTON_HEIGHT) + 2; + tr.UpperLeftCorner.Y += tabHeight + 2; tr.LowerRightCorner.X -= 1; tr.UpperLeftCorner.X += 1; tr.LowerRightCorner.Y -= 1; + } + else + { + tr = rect; + tr.UpperLeftCorner.X += 1; + tr.UpperLeftCorner.Y -= 1; + tr.LowerRightCorner.X -= 1; + tr.LowerRightCorner.Y -= tabHeight + 2; + //tr.UpperLeftCorner.X += 1; + } if (!UseGradient) Driver->draw2DRectangle(getColor(EGDC_3D_FACE), tr, clip); diff -abBdpuNPr --exclude='*.svn' irrlicht-svn-ss/trunk/source/Irrlicht/CGUISkin.h Irrlicht_starsonata/source/Irrlicht/CGUISkin.h --- irrlicht-svn-ss/trunk/source/Irrlicht/CGUISkin.h 2007-07-26 02:11:08.000000000 +0200 +++ Irrlicht_starsonata/source/Irrlicht/CGUISkin.h 2008-05-23 00:58:52.000000000 +0200 @@ -161,7 +172,8 @@ namespace gui \param clip: Clip area. */ virtual void draw3DTabButton(IGUIElement* element, bool active, const core::rect& rect, - const core::rect* clip=0); + const core::rect* clip=0, + EGUI_VERTICAL_ALIGNMENT alignment=EGVA_TOP); //! draws a tab control body /** \param element: Pointer to the element which whiches to draw this. This parameter @@ -170,10 +182,13 @@ namespace gui \param border: Specifies if the border should be drawn. \param background: Specifies if the background should be drawn. \param rect: Defining area where to draw. - \param clip: Clip area. */ + \param clip: Clip area. + \param tabHeight: Defines the height of the tabs.*/ virtual void draw3DTabBody(IGUIElement* element, bool border, bool background, const core::rect& rect, - const core::rect* clip=0); + const core::rect* clip=0, + s32 tabHeight=-1, + EGUI_VERTICAL_ALIGNMENT alignment=EGVA_TOP); //! draws an icon, usually from the skin's sprite bank /** \param parent: Pointer to the element which wishes to draw this icon.