1
0
forked from 0ad/0ad

This was SVN commit r2115.

This commit is contained in:
Gee 2005-04-07 09:13:10 +00:00
parent 61fbbae8d9
commit 1e8d354404
7 changed files with 55 additions and 28 deletions

View File

@ -21,6 +21,7 @@ gee@pyro.nu
#include "CCheckBox.h"
#include "CRadioButton.h"
#include "CInput.h"
#include "CList.h"
#include "CProgressBar.h"
#include "CTooltip.h"
#include "MiniMap.h"
@ -329,6 +330,7 @@ void CGUI::Initialize()
AddObjectType("progressbar", &CProgressBar::ConstructObject);
AddObjectType("minimap", &CMiniMap::ConstructObject);
AddObjectType("input", &CInput::ConstructObject);
AddObjectType("list", &CList::ConstructObject);
}
void CGUI::Process()
@ -1229,11 +1231,6 @@ void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec
if (element_name == elmt_object)
{
//debug_warn("CGUI::Xeromyces_ReadObject error");
// janwas: this happens but looks to be handled
// TODO Gee: REPORT ERROR
// Call this function on the child
Xeromyces_ReadObject(child, pFile, object);
}
@ -1265,6 +1262,14 @@ void CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObjec
CStr action = (CStr)child.getAttributes().getNamedItem(attr_on);
object->RegisterScriptHandler(action.LowerCase(), code, this);
}
else
{
// Try making the object read the tag.
if (!object->HandleAdditionalChildren(child, pFile))
{
LOG(ERROR, LOG_CATEGORY, "(object: %s) Reading unknown children for its type");
}
}
}
//
@ -1655,42 +1660,42 @@ void CGUI::Xeromyces_ReadScrollBarStyle(XMBElement Element, CXeromyces* pFile)
if (attr_name == "sprite_button_top")
scrollbar.m_SpriteButtonTop = attr_value;
else
if (attr_name == "sprite_button_top-pressed")
if (attr_name == "sprite_button_top_pressed")
scrollbar.m_SpriteButtonTopPressed = attr_value;
else
if (attr_name == "sprite_button_top-disabled")
if (attr_name == "sprite_button_top_disabled")
scrollbar.m_SpriteButtonTopDisabled = attr_value;
else
if (attr_name == "sprite_button_top-over")
if (attr_name == "sprite_button_top_over")
scrollbar.m_SpriteButtonTopOver = attr_value;
else
if (attr_name == "sprite_button_bottom")
scrollbar.m_SpriteButtonBottom = attr_value;
else
if (attr_name == "sprite_button_bottom-pressed")
if (attr_name == "sprite_button_bottom_pressed")
scrollbar.m_SpriteButtonBottomPressed = attr_value;
else
if (attr_name == "sprite_button_bottom-disabled")
if (attr_name == "sprite_button_bottom_disabled")
scrollbar.m_SpriteButtonBottomDisabled = attr_value;
else
if (attr_name == "sprite_button_bottom-over")
if (attr_name == "sprite_button_bottom_over")
scrollbar.m_SpriteButtonBottomOver = attr_value;
else
if (attr_name == "sprite_back_vertical")
scrollbar.m_SpriteBackVertical = attr_value;
else
if (attr_name == "sprite_bar-vertical")
if (attr_name == "sprite_bar_vertical")
scrollbar.m_SpriteBarVertical = attr_value;
else
if (attr_name == "sprite_bar-vertical-over")
if (attr_name == "sprite_bar_vertical_over")
scrollbar.m_SpriteBarVerticalOver = attr_value;
else
if (attr_name == "sprite_bar-vertical-pressed")
if (attr_name == "sprite_bar_vertical_pressed")
scrollbar.m_SpriteBarVerticalPressed = attr_value;
}
//
// Add to CGUI
// Add to CGUI
//
m_ScrollBarStyles[name] = scrollbar;

View File

@ -7,6 +7,9 @@ gee@pyro.nu
#include "precompiled.h"
#include "GUI.h"
#include "ps/CLogger.h"
#define LOG_CATEGORY "gui"
using namespace std;
CGUIScrollBarVertical::CGUIScrollBarVertical()
@ -38,7 +41,7 @@ void CGUIScrollBarVertical::Draw()
CRect outline = GetOuterRect();
// Draw background
GetGUI()->DrawSprite(GetStyle()->m_SpriteBackVertical,
/*GetGUI()->DrawSprite(GetStyle()->m_SpriteBackVertical,
0,
m_Z+0.1f,
CRect(outline.left,
@ -46,7 +49,7 @@ void CGUIScrollBarVertical::Draw()
outline.right,
outline.bottom-(m_UseEdgeButtons?GetStyle()->m_Width:0))
);
*/
if (m_UseEdgeButtons)
{
// Get Appropriate sprites
@ -93,8 +96,12 @@ void CGUIScrollBarVertical::Draw()
);
}
LOG(ERROR, LOG_CATEGORY, "GetBarRect(%f,%f,%f,%f)", GetBarRect().left, GetBarRect().top, GetBarRect().right, GetBarRect().bottom);
LOG(ERROR, LOG_CATEGORY, "m_SpriteBarVertical = %s", GetStyle()->m_SpriteBarVertical.GetName().c_str());
LOG(ERROR, LOG_CATEGORY, "m_SpriteBackVertical = %s", GetStyle()->m_SpriteBackVertical.GetName().c_str());
// Draw bar
if (m_BarPressed)
/*if (m_BarPressed)
GetGUI()->DrawSprite(GUI<>::FallBackSprite(GetStyle()->m_SpriteBarVerticalPressed, GetStyle()->m_SpriteBarVertical),
0,
m_Z+0.2f,
@ -105,7 +112,7 @@ void CGUIScrollBarVertical::Draw()
0,
m_Z+0.2f,
GetBarRect());
else
else*/
GetGUI()->DrawSprite(GetStyle()->m_SpriteBarVertical,
0,
m_Z+0.2f,

View File

@ -82,7 +82,6 @@ public:
*/
void SetRightAligned(const bool &align) { m_RightAligned = align; }
protected:
/**
* Get the rectangle of the actual BAR.
* @return Rectangle, CRect
@ -96,6 +95,7 @@ protected:
*/
virtual CRect GetOuterRect() const;
protected:
/**
* Should the scroll bar proceed to the left or to the right of the m_X value.
* Notice, this has nothing to do with where the owner places it.

View File

@ -126,6 +126,8 @@ void CText::HandleMessage(const SGUIMessage &Message)
GUI<CStr>::GetSetting(this, Message.value, scrollbar_style);
GetScrollBar(0).SetScrollBarStyle( scrollbar_style );
SetupText();
}
break;

View File

@ -37,6 +37,8 @@ gee@pyro.nu
#include <vector>
#include "lib/input.h" // just for EV_PASS
#include "ps/Xeromyces.h"
#include "gui/scripting/JSInterface_IGUIObject.h"
struct SGUISetting;
@ -316,7 +318,7 @@ protected:
*
* @param Message GUI Message
*/
virtual void HandleMessage(const SGUIMessage& UNUSEDPARAM(Message)) {};
virtual void HandleMessage(const SGUIMessage& UNUSEDPARAM(Message)) {}
/**
* Draws the object.
@ -416,6 +418,17 @@ protected:
*/
CPos GetMousePos() const;
/**
* Handle additional children to the <object>-tag. In IGUIObject, this function does
* nothing. In CList and CDropDown, it handles the <item>, used to build the data.
*
* Returning false means the object doesn't recognize the child. Should be reported.
* Notice 'false' is default, because an object not using this function, should not
* have any additional children (and this function should never be called).
*/
virtual bool HandleAdditionalChildren(const XMBElement& UNUSEDPARAM(child),
CXeromyces* UNUSEDPARAM(pFile)) { return false; }
/**
* Cached size, real size m_Size is actually dependent on resolution
* and can have different *real* outcomes, this is the real outcome

View File

@ -295,12 +295,6 @@ public:
*/
SGUIScrollBarStyle * GetStyle() const;
protected:
/**
* Sets up bar size
*/
void SetupBarSize();
/**
* Get the rectangle of the actual BAR. not the whole scroll-bar.
* @return Rectangle, CRect
@ -314,6 +308,12 @@ protected:
*/
virtual CRect GetOuterRect() const = 0;
protected:
/**
* Sets up bar size
*/
void SetupBarSize();
/**
* Call every time m_Pos has been updated.
*/

View File

@ -18,7 +18,7 @@ IGUITextOwner::IGUITextOwner()
IGUITextOwner::~IGUITextOwner()
{
// Delete scroll-bars
// Delete all generated texts.
vector<SGUIText*>::iterator it;
for (it=m_GeneratedTexts.begin(); it!=m_GeneratedTexts.end(); ++it)
{