CList, COList, CDropdown, CText, CInput: Draw borders above the rest and improve scrollbar drawing order
Fixes: #6055 Differential Revision: https://code.wildfiregames.com/D4004 This was SVN commit r25587.
This commit is contained in:
parent
d50ca8e8ec
commit
6f9a162dfa
@ -149,6 +149,18 @@
|
||||
- Box -
|
||||
==========================================
|
||||
-->
|
||||
<sprite name = "ModernDarkBox">
|
||||
<image backcolor = "12 12 12 100"
|
||||
size = "0 0 100% 100%-1"
|
||||
/>
|
||||
</sprite>
|
||||
<sprite name="ModernDarkBoxDisabled">
|
||||
<effect grayscale=""/>
|
||||
<!-- background -->
|
||||
<image backcolor = "12 12 12 100"
|
||||
size = "0 1 100% 100%-1"
|
||||
/>
|
||||
</sprite>
|
||||
<sprite name="ModernDarkBoxGold">
|
||||
<!-- borders -->
|
||||
<image texture = "global/modern/gold-separator.png"
|
||||
@ -164,6 +176,17 @@
|
||||
size = "0 1 100% 100%-1"
|
||||
/>
|
||||
</sprite>
|
||||
<sprite name="ModernDarkBoxGoldBorder">
|
||||
<!-- borders -->
|
||||
<image texture = "global/modern/gold-separator.png"
|
||||
real_texture_placement = "0 0 806 1"
|
||||
size = "0 0 100% 1"
|
||||
/>
|
||||
<image texture = "global/modern/gold-separator.png"
|
||||
real_texture_placement = "0 0 806 1"
|
||||
size = "0 100%-1 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
<sprite name="ModernDarkBoxGoldDisabled">
|
||||
<effect grayscale=""/>
|
||||
<!-- borders -->
|
||||
@ -180,6 +203,18 @@
|
||||
size = "0 1 100% 100%-1"
|
||||
/>
|
||||
</sprite>
|
||||
<sprite name="ModernDarkBoxGoldBorderDisabled">
|
||||
<effect grayscale=""/>
|
||||
<!-- borders -->
|
||||
<image texture = "global/modern/gold-separator.png"
|
||||
real_texture_placement = "0 0 806 1"
|
||||
size = "0 0 100% 1"
|
||||
/>
|
||||
<image texture = "global/modern/gold-separator.png"
|
||||
real_texture_placement = "0 0 806 1"
|
||||
size = "0 100%-1 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
<sprite name="ModernDarkBoxWhite">
|
||||
<!-- borders -->
|
||||
<image texture = "global/modern/white-separator.png"
|
||||
@ -195,6 +230,17 @@
|
||||
size = "0 1 100% 100%-1"
|
||||
/>
|
||||
</sprite>
|
||||
<sprite name="ModernDarkBoxWhiteBorder">
|
||||
<!-- borders -->
|
||||
<image texture = "global/modern/white-separator.png"
|
||||
real_texture_placement = "0 0 806 1"
|
||||
size = "0 0 100% 1"
|
||||
/>
|
||||
<image texture = "global/modern/white-separator.png"
|
||||
real_texture_placement = "0 0 806 1"
|
||||
size = "0 100%-1 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
<sprite name="ModernDarkBoxWhiteInvalid">
|
||||
<!-- borders -->
|
||||
<image texture = "global/modern/white-separator.png"
|
||||
@ -219,14 +265,11 @@
|
||||
size = "0 1 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
<sprite name = "ModernDarkBoxGoldNoTop">
|
||||
<sprite name="ModernDarkBoxBottomGold">
|
||||
<image texture = "global/modern/gold-separator.png"
|
||||
real_texture_placement = "0 0 806 1"
|
||||
size = "0 100%-1 100% 100%"
|
||||
/>
|
||||
<image backcolor = "12 12 12 100"
|
||||
size = "0 0 100% 100%-1"
|
||||
/>
|
||||
</sprite>
|
||||
<!--
|
||||
==========================================
|
||||
@ -521,6 +564,17 @@
|
||||
<image backcolor="0 0 0" size="0 0 1 100%"/>
|
||||
<image backcolor="0 0 0" size="100%-1 0 100% 100%"/>
|
||||
</sprite>
|
||||
<sprite name="GrayBackground">
|
||||
<image backcolor="darkgray"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
<sprite name="BlackBorder">
|
||||
<image backcolor="0 0 0" size="0 0 100% 1"/>
|
||||
<image backcolor="0 0 0" size="0 100%-1 100% 100%"/>
|
||||
<image backcolor="0 0 0" size="0 0 1 100%"/>
|
||||
<image backcolor="0 0 0" size="100%-1 0 100% 100%"/>
|
||||
</sprite>
|
||||
<!--
|
||||
==========================================
|
||||
- Misc. -
|
||||
|
@ -28,8 +28,10 @@
|
||||
font="sans-bold-stroke-14"
|
||||
scrollbar="true"
|
||||
scrollbar_style="ModernScrollBar"
|
||||
sprite="ModernDarkBoxGoldNoTop"
|
||||
sprite_selectarea="ModernDarkBoxWhite"
|
||||
sprite="ModernDarkBox"
|
||||
sprite_overlay="ModernDarkBoxBottomGold"
|
||||
sprite_selectarea="ModernDarkBox"
|
||||
sprite_selectarea_overlay="ModernDarkBoxWhiteBorder"
|
||||
textcolor="white"
|
||||
textcolor_selected="white"
|
||||
text_align="left"
|
||||
@ -40,8 +42,10 @@
|
||||
font="sans-bold-stroke-14"
|
||||
scrollbar="true"
|
||||
scrollbar_style="ModernScrollBar"
|
||||
sprite="ModernDarkBoxGoldNoTop"
|
||||
sprite_selectarea="ModernDarkBoxWhite"
|
||||
sprite="ModernDarkBox"
|
||||
sprite_overlay="ModernDarkBoxBottomGold"
|
||||
sprite_selectarea="ModernDarkBox"
|
||||
sprite_selectarea_overlay="ModernDarkBoxWhiteBorder"
|
||||
sprite_heading="ModernDarkBoxGoldNoBottom"
|
||||
sprite_asc="ModernArrowUp"
|
||||
sprite_desc="ModernArrowDown"
|
||||
@ -58,16 +62,20 @@
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
button_width="16"
|
||||
sprite="ModernDarkBoxGold"
|
||||
sprite_disabled="ModernDarkBoxGoldDisabled"
|
||||
sprite="ModernDarkBox"
|
||||
sprite_disabled="ModernDarkBoxDisabled"
|
||||
sprite_overlay="ModernDarkBoxGoldBorder"
|
||||
sprite_overlay_disabled="ModernDarkBoxGoldBorderDisabled"
|
||||
sprite2="ModernDropDownArrow"
|
||||
sprite2_disabled="ModernDropDownArrowDisabled"
|
||||
sprite2_pressed="ModernDropDownArrowHighlight"
|
||||
buffer_zone="8"
|
||||
dropdown_size="225"
|
||||
minimum_visible_items="3"
|
||||
sprite_list="BlackBorderOnGray"
|
||||
sprite_selectarea="ModernDarkBoxWhite"
|
||||
sprite_list="GrayBackground"
|
||||
sprite_list_overlay="BlackBorder"
|
||||
sprite_selectarea="ModernDarkBox"
|
||||
sprite_selectarea_overlay="ModernDarkBoxWhiteBorder"
|
||||
textcolor_selected="white"
|
||||
textcolor_disabled="140 140 140 255"
|
||||
scrollbar="true"
|
||||
@ -124,10 +132,12 @@
|
||||
textcolor="white"
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
sprite="ModernDarkBoxGold"
|
||||
sprite="ModernDarkBox"
|
||||
sprite_overlay="ModernDarkBoxGoldBorder"
|
||||
/>
|
||||
<style name="ModernInput"
|
||||
sprite="ModernDarkBoxWhite"
|
||||
sprite="ModernDarkBox"
|
||||
sprite_overlay="ModernDarkBoxWhiteBorder"
|
||||
sprite_selectarea="color:150 0 0"
|
||||
textcolor="white"
|
||||
textcolor_selected="white"
|
||||
|
@ -377,6 +377,9 @@
|
||||
<optional>
|
||||
<attribute name="sprite_list"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="sprite_list_overlay"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="sprite2_disabled"/>
|
||||
</optional>
|
||||
@ -386,6 +389,12 @@
|
||||
<optional>
|
||||
<attribute name="sprite_over"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="sprite_overlay"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="sprite_overlay_disabled"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="sprite2_over"/>
|
||||
</optional>
|
||||
@ -398,6 +407,9 @@
|
||||
<optional>
|
||||
<attribute name="sprite_selectarea"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="sprite_selectarea_overlay"/>
|
||||
</optional>
|
||||
<optional>
|
||||
<attribute name="square_side">
|
||||
<data type="decimal"/>
|
||||
|
@ -123,7 +123,8 @@
|
||||
textcolor="white"
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
sprite="ModernDarkBoxGold"
|
||||
sprite="ModernDarkBox"
|
||||
sprite_overlay="ModernDarkBoxGoldBorder"
|
||||
/>
|
||||
|
||||
</styles>
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
<object name="playerName[n]" type="text" style="ModernLabelText" size="0 2 22% 30"/>
|
||||
|
||||
<object name="playerColor[n]" type="dropdown" style="ModernDropDown" size="22%+5 2 22%+33 30" sprite="" scrollbar="false" button_width="22" font="sans-stroke-14" tooltip_style="onscreenToolTip"/>
|
||||
<object name="playerColor[n]" type="dropdown" style="ModernDropDown" size="22%+5 2 22%+33 30" sprite="" sprite_overlay="" scrollbar="false" button_width="22" font="sans-stroke-14" tooltip_style="onscreenToolTip"/>
|
||||
|
||||
<object name="playerAssignment[n]" type="dropdown" style="ModernDropDown" size="22%+37 2 50%+35 30" tooltip_style="onscreenToolTip"/>
|
||||
<object name="playerAssignmentText[n]" type="text" style="ModernLabelText" size="22%+37 0 50%+35 30"/>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<object name="chatPanel" type="image" sprite="ModernDarkBoxGold">
|
||||
<object name="chatPanel" type="image" sprite="ModernDarkBox">
|
||||
|
||||
<object name="chatText" type="list" size="2 2 100%-2 100%-28" style="ChatPanelList"/>
|
||||
|
||||
@ -9,4 +9,6 @@
|
||||
<translatableAttribute id="caption">Send</translatableAttribute>
|
||||
</object>
|
||||
|
||||
<!-- Draw the border last so that it will be above all text -->
|
||||
<object type="image" sprite="ModernDarkBoxGoldBorder" ghost="true"/>
|
||||
</object>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<object name="chatPanel" type="image" sprite="ModernDarkBoxGold">
|
||||
<object name="chatPanel" type="image" sprite="ModernDarkBox">
|
||||
|
||||
<script directory="gui/lobby/LobbyPage/Chat/"/>
|
||||
<script directory="gui/lobby/LobbyPage/Chat/ChatMessages/"/>
|
||||
@ -11,4 +11,7 @@
|
||||
<object name="chatSubmit" size="100%-72 100%-26 100%-4 100%-4" type="button" style="StoneButton">
|
||||
<translatableAttribute id="caption">Send</translatableAttribute>
|
||||
</object>
|
||||
|
||||
<!-- Draw the border last so that it will be above all text -->
|
||||
<object type="image" sprite="ModernDarkBoxGoldBorder" ghost="true"/>
|
||||
</object>
|
||||
|
@ -42,7 +42,9 @@ CDropDown::CDropDown(CGUI& pGUI)
|
||||
m_SoundOpened(this, "sound_opened"),
|
||||
// Setting "sprite" is registered by CList and used as the background
|
||||
m_SpriteDisabled(this, "sprite_disabled"),
|
||||
m_SpriteOverlayDisabled(this, "sprite_overlay_disabled"),
|
||||
m_SpriteList(this, "sprite_list"), // Background of the drop down list
|
||||
m_SpriteListOverlay(this, "sprite_list_overlay"), // Overlay above the drop down list
|
||||
m_Sprite2(this, "sprite2"), // Button that sits to the right
|
||||
m_Sprite2Over(this, "sprite2_over"),
|
||||
m_Sprite2Pressed(this, "sprite2_pressed"),
|
||||
@ -421,6 +423,7 @@ bool CDropDown::IsMouseOver() const
|
||||
void CDropDown::Draw()
|
||||
{
|
||||
const CGUISpriteInstance& sprite = m_Enabled ? m_Sprite : m_SpriteDisabled;
|
||||
const CGUISpriteInstance& spriteOverlay = m_Enabled ? m_SpriteOverlay : m_SpriteOverlayDisabled;
|
||||
|
||||
m_pGUI.DrawSprite(sprite, m_CachedActualSize);
|
||||
|
||||
@ -463,11 +466,12 @@ void CDropDown::Draw()
|
||||
if (m_HideScrollBar)
|
||||
m_ScrollBar.Set(false, false);
|
||||
|
||||
DrawList(m_ElementHighlight, m_SpriteList, m_SpriteSelectArea, m_TextColor);
|
||||
DrawList(m_ElementHighlight, m_SpriteList, m_SpriteListOverlay, m_SpriteSelectArea, m_SpriteSelectAreaOverlay, m_TextColor);
|
||||
|
||||
if (m_HideScrollBar)
|
||||
m_ScrollBar.Set(old, false);
|
||||
}
|
||||
m_pGUI.DrawSprite(spriteOverlay, m_CachedActualSize);
|
||||
}
|
||||
|
||||
// When a dropdown list is opened, it needs to be visible above all the other
|
||||
|
@ -132,7 +132,9 @@ protected:
|
||||
CGUISimpleSetting<CStrW> m_SoundLeave;
|
||||
CGUISimpleSetting<CStrW> m_SoundOpened;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_SpriteDisabled;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_SpriteOverlayDisabled;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_SpriteList;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_SpriteListOverlay;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_Sprite2;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_Sprite2Over;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_Sprite2Pressed;
|
||||
|
@ -69,6 +69,7 @@ CInput::CInput(CGUI& pGUI)
|
||||
m_ScrollBar(this, "scrollbar"),
|
||||
m_ScrollBarStyle(this, "scrollbar_style"),
|
||||
m_Sprite(this, "sprite"),
|
||||
m_SpriteOverlay(this, "sprite_overlay"),
|
||||
m_SpriteSelectArea(this, "sprite_selectarea"),
|
||||
m_TextColor(this, "textcolor"),
|
||||
m_TextColorSelected(this, "textcolor_selected"),
|
||||
@ -1202,10 +1203,6 @@ void CInput::Draw()
|
||||
// should always be visible
|
||||
m_CursorVisState = true;
|
||||
|
||||
// First call draw on ScrollBarOwner
|
||||
if (m_ScrollBar && m_MultiLine)
|
||||
IGUIScrollBarOwner::Draw();
|
||||
|
||||
CStrIntern font_name(m_Font->ToUTF8());
|
||||
|
||||
wchar_t mask_char = L'*';
|
||||
@ -1529,6 +1526,13 @@ void CInput::Draw()
|
||||
|
||||
if (m_Caption->empty() && !m_PlaceholderText->GetRawString().empty())
|
||||
DrawPlaceholderText(cliparea);
|
||||
|
||||
// Draw scrollbars on top of the content
|
||||
if (m_ScrollBar && m_MultiLine)
|
||||
IGUIScrollBarOwner::Draw();
|
||||
|
||||
// Draw the overlays last
|
||||
m_pGUI.DrawSprite(m_SpriteOverlay, m_CachedActualSize);
|
||||
}
|
||||
|
||||
void CInput::DrawPlaceholderText(const CRect& clipping)
|
||||
|
@ -229,6 +229,7 @@ protected:
|
||||
CGUISimpleSetting<bool> m_ScrollBar;
|
||||
CGUISimpleSetting<CStr> m_ScrollBarStyle;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_Sprite;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_SpriteOverlay;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_SpriteSelectArea;
|
||||
CGUISimpleSetting<CGUIColor> m_TextColor;
|
||||
CGUISimpleSetting<CGUIColor> m_TextColorSelected;
|
||||
|
@ -46,8 +46,10 @@ CList::CList(CGUI& pGUI)
|
||||
m_SoundDisabled(this, "sound_disabled"),
|
||||
m_SoundSelected(this, "sound_selected"),
|
||||
m_Sprite(this, "sprite"),
|
||||
m_SpriteOverlay(this, "sprite_overlay"),
|
||||
// Add sprite_disabled! TODO
|
||||
m_SpriteSelectArea(this, "sprite_selectarea"),
|
||||
m_SpriteSelectAreaOverlay(this, "sprite_selectarea_overlay"),
|
||||
m_TextColor(this, "textcolor"),
|
||||
m_TextColorSelected(this, "textcolor_selected"),
|
||||
m_Selected(this, "selected", -1), // Index selected. -1 is none.
|
||||
@ -299,10 +301,11 @@ InReaction CList::ManuallyHandleKeys(const SDL_Event_* ev)
|
||||
|
||||
void CList::Draw()
|
||||
{
|
||||
DrawList(m_Selected, m_Sprite, m_SpriteSelectArea, m_TextColor);
|
||||
DrawList(m_Selected, m_Sprite, m_SpriteOverlay, m_SpriteSelectArea, m_SpriteSelectAreaOverlay, m_TextColor);
|
||||
}
|
||||
|
||||
void CList::DrawList(const int& selected, const CGUISpriteInstance& sprite, const CGUISpriteInstance& sprite_selectarea, const CGUIColor& textcolor)
|
||||
void CList::DrawList(const int& selected, const CGUISpriteInstance& sprite, const CGUISpriteInstance& spriteOverlay,
|
||||
const CGUISpriteInstance& spriteSelectArea, const CGUISpriteInstance& spriteSelectAreaOverlay, const CGUIColor& textColor)
|
||||
{
|
||||
CRect rect = GetListRect();
|
||||
|
||||
@ -312,34 +315,36 @@ void CList::DrawList(const int& selected, const CGUISpriteInstance& sprite, cons
|
||||
if (m_ScrollBar)
|
||||
scroll = GetScrollBar(0).GetPos();
|
||||
|
||||
bool drawSelected = false;
|
||||
CRect rectSel;
|
||||
if (selected >= 0 && selected+1 < (int)m_ItemsYPositions.size())
|
||||
{
|
||||
// Get rectangle of selection:
|
||||
CRect rect_sel(
|
||||
rectSel = CRect(
|
||||
rect.left, rect.top + m_ItemsYPositions[selected] - scroll,
|
||||
rect.right, rect.top + m_ItemsYPositions[selected+1] - scroll);
|
||||
|
||||
if (rect_sel.top <= rect.bottom &&
|
||||
rect_sel.bottom >= rect.top)
|
||||
if (rectSel.top <= rect.bottom &&
|
||||
rectSel.bottom >= rect.top)
|
||||
{
|
||||
if (rect_sel.bottom > rect.bottom)
|
||||
rect_sel.bottom = rect.bottom;
|
||||
if (rect_sel.top < rect.top)
|
||||
rect_sel.top = rect.top;
|
||||
|
||||
if (rectSel.bottom > rect.bottom)
|
||||
rectSel.bottom = rect.bottom;
|
||||
if (rectSel.top < rect.top)
|
||||
rectSel.top = rect.top;
|
||||
if (m_ScrollBar)
|
||||
{
|
||||
// Remove any overlapping area of the scrollbar.
|
||||
if (rect_sel.right > GetScrollBar(0).GetOuterRect().left &&
|
||||
rect_sel.right <= GetScrollBar(0).GetOuterRect().right)
|
||||
rect_sel.right = GetScrollBar(0).GetOuterRect().left;
|
||||
if (rectSel.right > GetScrollBar(0).GetOuterRect().left &&
|
||||
rectSel.right <= GetScrollBar(0).GetOuterRect().right)
|
||||
rectSel.right = GetScrollBar(0).GetOuterRect().left;
|
||||
|
||||
if (rect_sel.left >= GetScrollBar(0).GetOuterRect().left &&
|
||||
rect_sel.left < GetScrollBar(0).GetOuterRect().right)
|
||||
rect_sel.left = GetScrollBar(0).GetOuterRect().right;
|
||||
if (rectSel.left >= GetScrollBar(0).GetOuterRect().left &&
|
||||
rectSel.left < GetScrollBar(0).GetOuterRect().right)
|
||||
rectSel.left = GetScrollBar(0).GetOuterRect().right;
|
||||
}
|
||||
|
||||
m_pGUI.DrawSprite(sprite_selectarea, rect_sel);
|
||||
m_pGUI.DrawSprite(spriteSelectArea, rectSel);
|
||||
drawSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,11 +368,17 @@ void CList::DrawList(const int& selected, const CGUISpriteInstance& sprite, cons
|
||||
cliparea.left = GetScrollBar(0).GetOuterRect().right;
|
||||
}
|
||||
|
||||
DrawText(i, textcolor, rect.TopLeft() - CVector2D(0.f, scroll - m_ItemsYPositions[i]), cliparea);
|
||||
DrawText(i, textColor, rect.TopLeft() - CVector2D(0.f, scroll - m_ItemsYPositions[i]), cliparea);
|
||||
}
|
||||
|
||||
// Draw scrollbars on top of the content
|
||||
if (m_ScrollBar)
|
||||
IGUIScrollBarOwner::Draw();
|
||||
|
||||
// Draw the overlays last
|
||||
m_pGUI.DrawSprite(spriteOverlay, rect);
|
||||
if (drawSelected)
|
||||
m_pGUI.DrawSprite(spriteSelectAreaOverlay, rectSel);
|
||||
}
|
||||
|
||||
void CList::AddItem(const CGUIString& str, const CGUIString& data)
|
||||
|
@ -106,7 +106,8 @@ protected:
|
||||
|
||||
// Extended drawing interface, this is so that classes built on the this one
|
||||
// can use other sprite names.
|
||||
virtual void DrawList(const int& selected, const CGUISpriteInstance& sprite, const CGUISpriteInstance& sprite_selected, const CGUIColor& textcolor);
|
||||
virtual void DrawList(const int& selected, const CGUISpriteInstance& sprite, const CGUISpriteInstance& spriteOverlay,
|
||||
const CGUISpriteInstance& spriteSelectArea, const CGUISpriteInstance& spriteSelectAreaOverlay, const CGUIColor& textColor);
|
||||
|
||||
// Get the area of the list. This is so that it can easily be changed, like in CDropDown
|
||||
// where the area is not equal to m_CachedActualSize.
|
||||
@ -134,7 +135,9 @@ protected:
|
||||
CGUISimpleSetting<CStrW> m_SoundDisabled;
|
||||
CGUISimpleSetting<CStrW> m_SoundSelected;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_Sprite;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_SpriteOverlay;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_SpriteSelectArea;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_SpriteSelectAreaOverlay;
|
||||
CGUISimpleSetting<CGUIColor> m_TextColor;
|
||||
CGUISimpleSetting<CGUIColor> m_TextColorSelected;
|
||||
CGUISimpleSetting<i32> m_Selected;
|
||||
|
@ -280,11 +280,9 @@ void COList::AdditionalChildrenHandled()
|
||||
SetupText();
|
||||
}
|
||||
|
||||
void COList::DrawList(const int& selected, const CGUISpriteInstance& sprite, const CGUISpriteInstance& sprite_selected, const CGUIColor& textcolor)
|
||||
void COList::DrawList(const int& selected, const CGUISpriteInstance& sprite, const CGUISpriteInstance& spriteOverlay,
|
||||
const CGUISpriteInstance& spriteSelectArea, const CGUISpriteInstance& spriteSelectAreaOverlay, const CGUIColor& textColor)
|
||||
{
|
||||
if (m_ScrollBar)
|
||||
IGUIScrollBarOwner::Draw();
|
||||
|
||||
CRect rect = GetListRect();
|
||||
|
||||
m_pGUI.DrawSprite(sprite, rect);
|
||||
@ -293,37 +291,41 @@ void COList::DrawList(const int& selected, const CGUISpriteInstance& sprite, con
|
||||
if (m_ScrollBar)
|
||||
scroll = GetScrollBar(0).GetPos();
|
||||
|
||||
bool drawSelected = false;
|
||||
CRect rectSel;
|
||||
// Draw item selection
|
||||
if (selected != -1)
|
||||
{
|
||||
ENSURE(selected >= 0 && selected+1 < (int)m_ItemsYPositions.size());
|
||||
|
||||
// Get rectangle of selection:
|
||||
CRect rect_sel(rect.left, rect.top + m_ItemsYPositions[selected] - scroll,
|
||||
rect.right, rect.top + m_ItemsYPositions[selected+1] - scroll);
|
||||
rectSel = CRect(
|
||||
rect.left, rect.top + m_ItemsYPositions[selected] - scroll,
|
||||
rect.right, rect.top + m_ItemsYPositions[selected+1] - scroll);
|
||||
|
||||
if (rect_sel.top <= rect.bottom &&
|
||||
rect_sel.bottom >= rect.top)
|
||||
if (rectSel.top <= rect.bottom &&
|
||||
rectSel.bottom >= rect.top)
|
||||
{
|
||||
if (rect_sel.bottom > rect.bottom)
|
||||
rect_sel.bottom = rect.bottom;
|
||||
if (rect_sel.top < rect.top)
|
||||
rect_sel.top = rect.top;
|
||||
if (rectSel.bottom > rect.bottom)
|
||||
rectSel.bottom = rect.bottom;
|
||||
if (rectSel.top < rect.top)
|
||||
rectSel.top = rect.top;
|
||||
|
||||
if (m_ScrollBar)
|
||||
{
|
||||
// Remove any overlapping area of the scrollbar.
|
||||
if (rect_sel.right > GetScrollBar(0).GetOuterRect().left &&
|
||||
rect_sel.right <= GetScrollBar(0).GetOuterRect().right)
|
||||
rect_sel.right = GetScrollBar(0).GetOuterRect().left;
|
||||
if (rectSel.right > GetScrollBar(0).GetOuterRect().left &&
|
||||
rectSel.right <= GetScrollBar(0).GetOuterRect().right)
|
||||
rectSel.right = GetScrollBar(0).GetOuterRect().left;
|
||||
|
||||
if (rect_sel.left >= GetScrollBar(0).GetOuterRect().left &&
|
||||
rect_sel.left < GetScrollBar(0).GetOuterRect().right)
|
||||
rect_sel.left = GetScrollBar(0).GetOuterRect().right;
|
||||
if (rectSel.left >= GetScrollBar(0).GetOuterRect().left &&
|
||||
rectSel.left < GetScrollBar(0).GetOuterRect().right)
|
||||
rectSel.left = GetScrollBar(0).GetOuterRect().right;
|
||||
}
|
||||
|
||||
// Draw item selection
|
||||
m_pGUI.DrawSprite(sprite_selected, rect_sel);
|
||||
m_pGUI.DrawSprite(spriteSelectArea, rectSel);
|
||||
drawSelected = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -371,7 +373,7 @@ void COList::DrawList(const int& selected, const CGUISpriteInstance& sprite, con
|
||||
}
|
||||
|
||||
// Draw column header text
|
||||
DrawText(col, textcolor, leftTopCorner + COLUMN_SHIFT, rect_head);
|
||||
DrawText(col, textColor, leftTopCorner + COLUMN_SHIFT, rect_head);
|
||||
xpos += width;
|
||||
++col;
|
||||
}
|
||||
@ -426,4 +428,13 @@ void COList::DrawList(const int& selected, const CGUISpriteInstance& sprite, con
|
||||
xpos += width;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw scrollbars on top of the content
|
||||
if (m_ScrollBar)
|
||||
IGUIScrollBarOwner::Draw();
|
||||
|
||||
// Draw the overlays last
|
||||
m_pGUI.DrawSprite(spriteOverlay, rect);
|
||||
if (drawSelected)
|
||||
m_pGUI.DrawSprite(spriteSelectAreaOverlay, rectSel);
|
||||
}
|
||||
|
@ -67,7 +67,8 @@ protected:
|
||||
virtual bool HandleAdditionalChildren(const XMBData& xmb, const XMBElement& child);
|
||||
virtual void AdditionalChildrenHandled();
|
||||
|
||||
void DrawList(const int& selected, const CGUISpriteInstance& sprite, const CGUISpriteInstance& sprite_selected, const CGUIColor& textcolor);
|
||||
void DrawList(const int& selected, const CGUISpriteInstance& sprite, const CGUISpriteInstance& spriteOverlay,
|
||||
const CGUISpriteInstance& spriteSelectarea, const CGUISpriteInstance& spriteSelectAreaOverlay, const CGUIColor& textColor);
|
||||
|
||||
virtual CRect GetListRect() const;
|
||||
|
||||
|
@ -36,6 +36,7 @@ CText::CText(CGUI& pGUI)
|
||||
m_ScrollBottom(this, "scroll_bottom"),
|
||||
m_ScrollTop(this, "scroll_top"),
|
||||
m_Sprite(this, "sprite"),
|
||||
m_SpriteOverlay(this, "sprite_overlay"),
|
||||
m_TextColor(this, "textcolor"),
|
||||
m_TextColorDisabled(this, "textcolor_disabled")
|
||||
{
|
||||
@ -184,9 +185,6 @@ void CText::HandleMessage(SGUIMessage& Message)
|
||||
|
||||
void CText::Draw()
|
||||
{
|
||||
if (m_ScrollBar)
|
||||
IGUIScrollBarOwner::Draw();
|
||||
|
||||
m_pGUI.DrawSprite(m_Sprite, m_CachedActualSize);
|
||||
|
||||
float scroll = 0.f;
|
||||
@ -218,4 +216,11 @@ void CText::Draw()
|
||||
DrawText(0, color, m_CachedActualSize.TopLeft() - CVector2D(0.f, scroll), cliparea);
|
||||
else
|
||||
DrawText(0, color, m_TextPos, cliparea);
|
||||
|
||||
// Draw scrollbars on top of the content
|
||||
if (m_ScrollBar)
|
||||
IGUIScrollBarOwner::Draw();
|
||||
|
||||
// Draw the overlays last
|
||||
m_pGUI.DrawSprite(m_SpriteOverlay, m_CachedActualSize);
|
||||
}
|
||||
|
@ -83,6 +83,7 @@ protected:
|
||||
CGUISimpleSetting<bool> m_ScrollBottom;
|
||||
CGUISimpleSetting<bool> m_ScrollTop;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_Sprite;
|
||||
CGUISimpleSetting<CGUISpriteInstance> m_SpriteOverlay;
|
||||
CGUISimpleSetting<CGUIColor> m_TextColor;
|
||||
CGUISimpleSetting<CGUIColor> m_TextColorDisabled;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user