Fixed some bugs, updated some things, etc etc

This was SVN commit r2523.
This commit is contained in:
Gee 2005-07-23 22:27:55 +00:00
parent 4ad8de51bb
commit fe087a73f7
7 changed files with 29 additions and 17 deletions

View File

@ -19,12 +19,12 @@ CButton::CButton()
{
AddSetting(GUIST_float, "buffer_zone");
AddSetting(GUIST_CGUIString, "caption");
AddSetting(GUIST_int, "cell_id");
AddSetting(GUIST_CStr, "font");
AddSetting(GUIST_CGUISpriteInstance, "sprite");
AddSetting(GUIST_CGUISpriteInstance, "sprite_over");
AddSetting(GUIST_CGUISpriteInstance, "sprite_pressed");
AddSetting(GUIST_CGUISpriteInstance, "sprite_disabled");
AddSetting(GUIST_int, "cell_id");
AddSetting(GUIST_EAlign, "text_align");
AddSetting(GUIST_EVAlign, "text_valign");
AddSetting(GUIST_CColor, "textcolor");

View File

@ -17,20 +17,22 @@ using namespace std;
//-------------------------------------------------------------------
CDropDown::CDropDown() : m_Open(false), m_HideScrollBar(false), m_ElementHighlight(-1)
{
AddSetting(GUIST_float, "button_width");
AddSetting(GUIST_float, "dropdown_size");
AddSetting(GUIST_float, "dropdown_buffer");
AddSetting(GUIST_CStr, "font");
AddSetting(GUIST_CGUISpriteInstance, "sprite"); // Background that sits around the size
// AddSetting(GUIST_CStr, "font");
// AddSetting(GUIST_CGUISpriteInstance, "sprite"); // Background that sits around the size
AddSetting(GUIST_CGUISpriteInstance, "sprite_list"); // Background of the drop down list
AddSetting(GUIST_CGUISpriteInstance, "sprite2"); // Button that sits to the right
AddSetting(GUIST_CGUISpriteInstance, "sprite2_over");
AddSetting(GUIST_CGUISpriteInstance, "sprite2_pressed");
AddSetting(GUIST_CGUISpriteInstance, "sprite2_disabled");
AddSetting(GUIST_float, "button_width");
AddSetting(GUIST_EVAlign, "text_valign");
AddSetting(GUIST_CColor, "textcolor_over");
AddSetting(GUIST_CColor, "textcolor_pressed");
AddSetting(GUIST_CColor, "textcolor_disabled");
// Add these in CList! And implement TODO
//AddSetting(GUIST_CColor, "textcolor_over");
//AddSetting(GUIST_CColor, "textcolor_pressed");
//AddSetting(GUIST_CColor, "textcolor_disabled");
// Scrollbar is forced to be true.
GUI<bool>::SetSetting(this, "scrollbar", true);
@ -315,8 +317,11 @@ void CDropDown::Draw()
GetGUI()->DrawSprite(*sprite2, cell_id, bz+0.05f, rect);
}
CPos pos(m_CachedActualSize.left, m_CachedActualSize.top);
IGUITextOwner::Draw(selected, color, pos, bz+0.1f);
if (selected != -1) // TODO: Maybe check validity completely?
{
CPos pos(m_CachedActualSize.left, m_CachedActualSize.top);
IGUITextOwner::Draw(selected, color, pos, bz+0.1f);
}
bool *scrollbar=NULL, old;

View File

@ -122,8 +122,9 @@ int CGUI::HandleEvent(const SDL_Event* ev)
&IGUIObject::ChooseMouseOverAndClosest,
pNearest);
if (ev->type == SDL_MOUSEMOTION && pNearest)
pNearest->ScriptEvent("mousemove");
// Is placed in the UpdateMouseOver function
//if (ev->type == SDL_MOUSEMOTION && pNearest)
// pNearest->ScriptEvent("mousemove");
// Now we'll call UpdateMouseOver on *all* objects,
// we'll input the one hovered, and they will each
@ -163,6 +164,8 @@ int CGUI::HandleEvent(const SDL_Event* ev)
}
break;
// TODO Gee (!!!): This is weird, I've tested this, and mousewheelup is
// what I would call mousewheeldown!
case SDL_BUTTON_WHEELDOWN: // wheel down
if (pNearest)
{
@ -177,7 +180,7 @@ int CGUI::HandleEvent(const SDL_Event* ev)
if (pNearest)
{
pNearest->HandleMessage(SGUIMessage(GUIM_MOUSE_WHEEL_UP));
pNearest->ScriptEvent("mousewheelup");
pNearest->ScriptEvent("mousewheelup");
ret = EV_HANDLED;
}

View File

@ -41,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,
@ -49,7 +49,7 @@ void CGUIScrollBarVertical::Draw()
outline.right,
outline.bottom-(m_UseEdgeButtons?GetStyle()->m_Width:0))
);
*/
if (m_UseEdgeButtons)
{
// Get Appropriate sprites

View File

@ -17,6 +17,8 @@ using namespace std;
//-------------------------------------------------------------------
CList::CList()
{
// Add sprite_disabled! TODO
AddSetting(GUIST_float, "buffer_zone");
//AddSetting(GUIST_CGUIString, "caption"); will it break removing this? If I know my system, then no, but test just in case TODO (Gee).
AddSetting(GUIST_CStr, "font");
@ -155,6 +157,8 @@ void CList::HandleMessage(const SGUIMessage &Message)
// If selected is changed, call "SelectionChange"
if (Message.value == "selected")
{
// TODO: Check range
// TODO only works if lower-case, shouldn't it be made case sensitive instead?
ScriptEvent("selectionchange");
}

View File

@ -206,7 +206,7 @@ void IGUIObject::UpdateMouseOver(IGUIObject * const &pMouseOver)
// call mouse over
HandleMessage(GUIM_MOUSE_OVER);
ScriptEvent("mouseover");
ScriptEvent("mousemove");
}
else // Some other object (or none) is hovered
{

View File

@ -263,13 +263,13 @@ public:
* Set content length
* @param range Maximum scrollable range
*/
void SetScrollRange(const float &range) { m_ScrollRange = MAX(range, 1.f); SetupBarSize(); }
void SetScrollRange(const float &range) { m_ScrollRange = MAX(range, 1.f); SetupBarSize(); UpdatePosBoundaries(); }
/**
* Set space that is visible in the scrollable control.
* @param space Visible area in the scrollable control.
*/
void SetScrollSpace(const float &space) { m_ScrollSpace = space; SetupBarSize(); }
void SetScrollSpace(const float &space) { m_ScrollSpace = space; SetupBarSize(); UpdatePosBoundaries(); }
/**
* Set bar pressed