Ticket #3038: t3038_rename_vertical_scrollbar_add_sprites_wip_v1.patch
File t3038_rename_vertical_scrollbar_add_sprites_wip_v1.patch, 44.7 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/mod/gui/common/modern/setup.xml
9 9 --> 10 10 <scrollbar name="ModernScrollBar" 11 11 width = "15" 12 12 minimum_bar_size = "15" 13 13 maximum_bar_size = "15" 14 show_edge_buttons = " false"14 show_edge_buttons = "true" 15 15 sprite_back_vertical = "ModernScrollBack" 16 16 sprite_bar_vertical = "ModernScrollBar" 17 sprite_button_top = "ModernScrollBarUp" 18 sprite_button_top_over = "ModernScrollBarUpOver" 19 sprite_button_top_pressed = "ModernScrollBarUpPressed" 20 sprite_button_top_disabled = "ModernScrollBarUpDisabled" 21 sprite_button_bottom = "ModernScrollBarDown" 22 sprite_button_bottom_over = "ModernScrollBarDownOver" 23 sprite_button_bottom_disabled = "ModernScrollBarDownDisabed" 24 sprite_button_bottom_pressed = "ModernScrollBarDownPressed" 17 25 /> 18 26 <!-- 19 27 ========================================== 20 28 - TOOLTIPS - 21 29 ========================================== -
binaries/data/mods/mod/gui/common/modern/sprites.xml
21 21 <image texture = "global/modern/scrollback.png" 22 22 real_texture_placement = "0 0 15 128" 23 23 size = "0 0 100% 100%" 24 24 /> 25 25 </sprite> 26 26 27 <sprite name = "ModernScrollBar"> 27 28 <image texture = "global/modern/scrollbar.png" 28 29 real_texture_placement = "0 0 15 15" 29 30 size = "0 0 100% 100%" 30 31 /> 31 32 </sprite> 33 34 <sprite name = "ModernScrollBarUp"> 35 <image texture = "global/modern/arrow-up.png" 36 size = "0 0 100% 15" 37 /> 38 </sprite> 39 40 <sprite name = "ModernScrollBarUpOver"> 41 <effect add_color="blue" /> 42 <image texture = "global/modern/arrow-up.png" 43 size = "0 0 100% 15" 44 /> 45 </sprite> 46 47 <sprite name = "ModernScrollBarUpPressed"> 48 <effect add_color="red" /> 49 <image texture = "global/modern/arrow-up.png" 50 size = "0 0 100% 15" 51 /> 52 </sprite> 53 54 <sprite name = "ModernScrollBarUpDisabled"> 55 <effect add_color="gray" /> 56 <image texture = "global/modern/arrow-up.png" 57 size = "0 0 100% 15" 58 /> 59 </sprite> 60 61 <sprite name = "ModernScrollBarDown"> 62 <image texture = "global/modern/arrow-down.png" 63 size = "0 100%-15 100% 100%" 64 /> 65 </sprite> 66 67 <sprite name = "ModernScrollBarDownOver"> 68 <effect add_color="blue" /> 69 <image texture = "global/modern/arrow-down.png" 70 size = "0 100%-15 100% 100%" 71 /> 72 </sprite> 73 74 <sprite name = "ModernScrollBarDownPressed"> 75 <effect add_color="red" /> 76 <image texture = "global/modern/arrow-down.png" 77 size = "0 100%-15 100% 100%" 78 /> 79 </sprite> 80 81 <sprite name = "ModernScrollBarDownDisabled"> 82 <effect add_color="gray" /> 83 <image texture = "global/modern/arrow-down.png" 84 size = "0 100%-15 100% 100%" 85 /> 86 </sprite> 87 32 88 <!-- 33 89 ========================================== 34 90 - Window - 35 91 ========================================== 36 92 --> -
binaries/data/mods/mod/gui/common/modern/styles.xml
37 37 text_valign = "top" 38 38 /> 39 39 <style name = "ModernList" 40 40 buffer_zone = "5" 41 41 font = "sans-bold-stroke-14" 42 scrollbar = "true"42 scrollbar_vertical = "true" 43 43 scrollbar_style = "ModernScrollBar" 44 44 sprite = "ModernDarkBoxGoldNoTop" 45 45 sprite_selectarea = "ModernDarkBoxWhite" 46 46 sprite_heading = "ModernDarkBoxGoldNoBottom" 47 47 textcolor = "white" … … 66 66 dropdown_size="224" 67 67 sprite_list="BlackBorderOnGray" 68 68 sprite_selectarea="ModernDarkBoxWhite" 69 69 textcolor_selected="white" 70 70 71 scrollbar ="true"71 scrollbar_vertical="true" 72 72 scrollbar_style="ModernScrollBar" 73 73 74 74 sound_opened="audio/interface/ui/ui_button_click.ogg" 75 75 sound_closed="audio/interface/ui/ui_button_click.ogg" 76 76 sound_selected="audio/interface/ui/ui_button_click.ogg" … … 114 114 <style name="ModernText" 115 115 font="sans-14" 116 116 textcolor="white" 117 117 text_align="left" 118 118 text_valign="top" 119 scrollbar ="true"119 scrollbar_vertical="true" 120 120 scrollbar_style="ModernScrollBar" 121 121 /> 122 122 <style name="ModernInput" 123 123 sprite="ModernDarkBoxWhite" 124 124 sprite_selectarea="color:150 0 0" -
binaries/data/mods/mod/gui/gui.rnc
ex_settings = 67 67 attribute mask_char { xsd:string { minLength = "1" maxLength = "1" } }?& 68 68 attribute max_length { xsd:nonNegativeInteger }?& 69 69 attribute maxwidth { xsd:decimal }? & 70 70 attribute multiline { bool }?& 71 71 attribute offset { pos }?& 72 attribute scrollbar { bool }?&72 attribute scrollbar_vertical { bool }?& 73 73 attribute scrollbar_style { text }?& 74 74 attribute scroll_bottom { bool }?& 75 75 attribute sortable { bool }?& 76 76 attribute sound_closed { text }?& 77 77 attribute sound_disabled { text }?& -
binaries/data/mods/mod/gui/gui.rng
278 278 <attribute name="offset"> 279 279 <ref name="pos"/> 280 280 </attribute> 281 281 </optional> 282 282 <optional> 283 <attribute name="scrollbar ">283 <attribute name="scrollbar_vertical"> 284 284 <ref name="bool"/> 285 285 </attribute> 286 286 </optional> 287 287 <optional> 288 288 <attribute name="scrollbar_style"/> … … 291 291 <attribute name="scroll_bottom"> 292 292 <ref name="bool"/> 293 293 </attribute> 294 294 </optional> 295 295 <optional> 296 <attribute name="sortable"/> 296 <attribute name="sortable"> 297 <ref name="bool"/> 298 </attribute> 297 299 </optional> 298 300 <optional> 299 301 <attribute name="sound_closed"/> 300 302 </optional> 301 303 <optional> -
binaries/data/mods/mod/gui/modmod/styles.xml
2 2 3 3 <styles> 4 4 <style name="ModmodScrollbar" 5 5 buffer_zone="5" 6 6 font="sans-13" 7 scrollbar ="true"7 scrollbar_vertical="true" 8 8 scrollbar_style="ModernScrollBar" 9 9 scroll_bottom="true" 10 10 textcolor="white" 11 11 textcolor_selected="gold" 12 12 text_align="left" -
binaries/data/mods/public/gui/common/common_styles.xml
271 271 dropdown_size="310" 272 272 sprite_list="BackgroundListBox" 273 273 sprite_selectarea="BackgroundSelectArea" 274 274 textcolor_selected="white" 275 275 276 scrollbar ="true"276 scrollbar_vertical="true" 277 277 scrollbar_style="wheatScrollBar" 278 278 279 279 sound_opened="audio/interface/ui/ui_button_click.ogg" 280 280 sound_closed="audio/interface/ui/ui_button_click.ogg" 281 281 sound_selected="audio/interface/ui/ui_button_click.ogg" 282 282 /> 283 283 284 284 <style name="StoneList" 285 285 buffer_zone="5" 286 286 font="sans-bold-stroke-14" 287 scrollbar ="true"287 scrollbar_vertical="true" 288 288 scrollbar_style="wheatScrollBar" 289 289 sprite="BackgroundIndentFillDark" 290 290 sprite_selectarea="BackgroundSelectArea" 291 291 sprite_over="BackgroundIndentFillDark" 292 292 textcolor="white" -
binaries/data/mods/public/gui/credits/styles.xml
2 2 3 3 <styles> 4 4 5 5 <style name="textPanel" 6 6 buffer_zone="8" 7 scrollbar ="true"7 scrollbar_vertical="true" 8 8 scrollbar_style="ModernScrollBar" 9 9 font="sans-bold-stroke-14" 10 10 textcolor="white" 11 11 text_align="center" 12 12 text_valign="center" -
binaries/data/mods/public/gui/gamesetup/gamesetup.xml
82 82 <object size="1 36 100%-1 100%"> 83 83 <repeat count="8"> 84 84 <object name="playerBox[n]" size="0 0 100% 32" hidden="true"> 85 85 <object name="playerColor[n]" type="image" size="0 0 100% 100%"/> 86 86 <object name="playerName[n]" type="text" style="ModernLabelText" size="0 2 22% 30"/> 87 <object name="playerColorPicker[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">87 <object name="playerColorPicker[n]" type="dropdown" style="ModernDropDown" size="22%+5 2 22%+33 30" sprite="" scrollbar_vertical="false" button_width="22" font="sans-stroke-14" tooltip_style="onscreenToolTip"> 88 88 <translatableAttribute id="tooltip">Pick a color.</translatableAttribute> 89 89 </object> 90 90 <object name="playerAssignment[n]" type="dropdown" style="ModernDropDown" size="22%+37 2 50%+35 30" tooltip_style="onscreenToolTip"> 91 91 <translatableAttribute id="tooltip">Select player.</translatableAttribute> 92 92 </object> -
binaries/data/mods/public/gui/gamesetup/styles.xml
1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 3 3 <styles> 4 4 5 <!-- <style name="indentedPanel"6 buffer_zone="5"7 font="sans-14"8 sprite="wheatIndentFillLight"9 textcolor="black"10 textcolor_selected="white"11 text_align="left"12 text_valign="center"13 />-->14 15 5 <style name="MapDescription" 16 6 buffer_zone="8" 17 7 font="sans-12" 18 scrollbar ="true"8 scrollbar_vertical="true" 19 9 scrollbar_style="ModernScrollBar" 20 10 scroll_bottom="true" 21 11 textcolor="white" 22 12 text_align="left" 23 13 text_valign="top" 24 14 /> 25 15 26 27 16 <style name="ChatPanel" 28 17 buffer_zone="5" 29 18 font="sans-13" 30 scrollbar ="true"19 scrollbar_vertical="true" 31 20 scrollbar_style="ModernScrollBar" 32 21 scroll_bottom="true" 33 22 textcolor="white" 34 23 textcolor_selected="gold" 35 24 text_align="left" -
binaries/data/mods/public/gui/lobby/styles.xml
2 2 3 3 <styles> 4 4 <style name="ChatPanel" 5 5 buffer_zone="5" 6 6 font="sans-13" 7 scrollbar ="true"7 scrollbar_vertical="true" 8 8 scrollbar_style="ModernScrollBar" 9 9 scroll_bottom="true" 10 10 textcolor="white" 11 11 textcolor_selected="gold" 12 12 text_align="left" … … 14 14 /> 15 15 16 16 <style name="MapPlayerList" 17 17 buffer_zone="8" 18 18 font="sans-14" 19 scrollbar ="true"19 scrollbar_vertical="true" 20 20 scrollbar_style="ModernScrollBar" 21 21 scroll_bottom="true" 22 22 textcolor="white" 23 23 text_align="left" 24 24 text_valign="top" -
binaries/data/mods/public/gui/manual/styles.xml
3 3 <styles> 4 4 5 5 <style name="textPanel" 6 6 buffer_zone="8" 7 7 font="sans-bold-16" 8 scrollbar ="true"8 scrollbar_vertical="true" 9 9 scrollbar_style="ModernScrollBar" 10 10 textcolor="white" 11 11 textcolor_selected="black" 12 12 text_align="left" 13 13 text_valign="center" -
binaries/data/mods/public/gui/pregame/mainmenu.xml
523 523 524 524 <!-- PRE-RELEASE WARNING --> 525 525 <object 526 526 font="sans-14" 527 527 type="text" 528 scrollbar_vertical="true" 529 scrollbar_style="ModernScrollBar" 528 530 textcolor="white" 529 size="8 8 100%-8 100%-36" 530 ghost="true" 531 size="8 8 100%-8 150" 531 532 > 532 533 <!-- IMPORTANT: remember to update session/top_panel/label.xml in sync with this: --> 533 534 <attribute id="caption"> 534 <keep>[font="sans-bold-16"]</keep> 535 <translate>Alpha XX: Timosthenes</translate> 536 <keep>[/font]\n\n</keep> 537 <translate>WARNING: This is an early development version of the game. Many features have not been added yet.</translate> 535 <translate>WARNING: This is an early development version of the game. Many features have not been added yet. This is an early development version of the game. Many features have not been added yet. This is an early development version of the game. Many features have not been added yet. This is an early development version of the game. Many features have not been added yet. </translate> 538 536 </attribute> 539 537 </object> 540 538 541 539 <!-- GET INVOLVED --> 542 540 <object type="button" -
binaries/data/mods/public/gui/replaymenu/styles.xml
2 2 3 3 <styles> 4 4 <style name="MapPlayerList" 5 5 buffer_zone="8" 6 6 font="sans-14" 7 scrollbar ="true"7 scrollbar_vertical="true" 8 8 scrollbar_style="ModernScrollBar" 9 9 scroll_bottom="true" 10 10 textcolor="white" 11 11 text_align="left" 12 12 text_valign="top" -
binaries/data/mods/public/gui/structree/structree.xml
60 60 text_valign="top" 61 61 size="104 52 100%-8 100%" 62 62 /> 63 63 64 64 <!-- Structure Tree display --> 65 <object size="0 54+64 100%-124 100%-54" name="display_tree"> 65 <object 66 name="display_tree" 67 type="container" 68 scrollbar_vertical="true" 69 scrollbar_horizontal="true" 70 size="0 54+64 100%-124 100%-54" 71 > 66 72 <repeat count="4" var="n"> 67 73 <object name="phase[n]_phase" type="image"/> 68 74 <object name="phase[n]_bar"> 69 75 <repeat count="4" var="k"> 70 76 <object name="phase[n]_bar[k]" type="image" sprite="ProdBar"> -
binaries/data/mods/public/gui/structree/styles.xml
1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 3 3 <styles> 4 4 <style name="TreeDisplay" 5 5 sprite="ModernDarkBoxGold" 6 scrollbar ="true"6 scrollbar_vertical="true" 7 7 scrollbar_style="ModernScrollBar" 8 8 /> 9 9 10 10 <style name="StructNameSpecific" 11 11 textcolor="white" -
source/gui/CDropDown.cpp
CDropDown::CDropDown() 48 48 // Add these in CList! And implement TODO 49 49 //AddSetting(GUIST_CColor, "textcolor_over"); 50 50 //AddSetting(GUIST_CColor, "textcolor_pressed"); 51 51 //AddSetting(GUIST_CColor, "textcolor_disabled"); 52 52 53 // S crollbar is forced to be true.54 GUI<bool>::SetSetting(this, "scrollbar ", true);53 // Set default 54 GUI<bool>::SetSetting(this, "scrollbar_vertical", true); 55 55 } 56 56 57 57 CDropDown::~CDropDown() 58 58 { 59 59 } … … void CDropDown::HandleMessage(SGUIMessag 95 95 CPos mouse = GetMousePos(); 96 96 97 97 if (!GetListRect().PointInside(mouse)) 98 98 break; 99 99 100 bool scrollbar ;100 bool scrollbar_vertical; 101 101 CGUIList* pList; 102 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);102 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 103 103 GUI<CGUIList>::GetSettingPointer(this, "list", pList); 104 104 float scroll = 0.f; 105 if (scrollbar )105 if (scrollbar_vertical) 106 106 scroll = GetScrollBar(0).GetPos(); 107 107 108 108 CRect rect = GetListRect(); 109 109 mouse.y += scroll; 110 110 int set = -1; … … void CDropDown::Draw() 485 485 486 486 CPos pos(m_CachedActualSize.left, m_CachedActualSize.top); 487 487 DrawText(selected, color, pos, bz+0.1f, cliparea); 488 488 } 489 489 490 bool* scrollbar = NULL;490 bool* scrollbar_vertical = NULL; 491 491 bool old; 492 GUI<bool>::GetSettingPointer(this, "scrollbar ", scrollbar);492 GUI<bool>::GetSettingPointer(this, "scrollbar_vertical", scrollbar_vertical); 493 493 494 old = *scrollbar ;494 old = *scrollbar_vertical; 495 495 496 496 if (m_Open) 497 497 { 498 498 if (m_HideScrollBar) 499 *scrollbar = false;499 *scrollbar_vertical = false; 500 500 501 501 DrawList(m_ElementHighlight, "sprite_list", "sprite_selectarea", "textcolor"); 502 502 503 503 if (m_HideScrollBar) 504 *scrollbar = old;504 *scrollbar_vertical = old; 505 505 } 506 506 } 507 507 508 508 // When a dropdown list is opened, it needs to be visible above all the other 509 509 // controls on the page. The only way I can think of to do this is to increase -
source/gui/CGUI.cpp
IGUIObject* CGUI::ConstructObject(const 315 315 } 316 316 } 317 317 318 318 void CGUI::Initialize() 319 319 { 320 // Add base types!321 320 // You can also add types outside the GUI to extend the flexibility of the GUI. 322 321 // Pyrogenesis though will have all the object types inserted from here. 323 322 AddObjectType("empty", &CGUIDummyObject::ConstructObject); 324 323 AddObjectType("button", &CButton::ConstructObject); 325 324 AddObjectType("image", &CImage::ConstructObject); … … void CGUI::Xeromyces_ReadObject(XMBEleme 979 978 // Our object we are going to create 980 979 IGUIObject* object = NULL; 981 980 982 981 XMBAttributeList attributes = Element.GetAttributes(); 983 982 984 // Well first of all we need to determine the type985 983 CStr type(attributes.GetNamedItem(pFile->GetAttributeID("type"))); 986 984 if (type.empty()) 987 985 type = "empty"; 988 986 989 987 // Construct object from specified type … … void CGUI::Xeromyces_ReadImage(XMBElemen 1627 1625 { 1628 1626 debug_warn(L"Invalid data - DTD shouldn't allow this"); 1629 1627 } 1630 1628 } 1631 1629 1632 //1633 // Input1634 //1635 1636 1630 parent.AddImage(Image); 1637 1631 } 1638 1632 1639 1633 void CGUI::Xeromyces_ReadEffects(XMBElement Element, CXeromyces* pFile, SGUIImageEffects& effects) 1640 1634 { … … void CGUI::Xeromyces_ReadScrollBarStyle( 1748 1742 if (!GUI<float>::ParseString(attr_value.FromUTF8(), f)) 1749 1743 LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, attr_value); 1750 1744 else 1751 1745 scrollbar.m_MaximumBarSize = f; 1752 1746 } 1747 // Vertical scrollbar style 1753 1748 else if (attr_name == "sprite_button_top") 1754 1749 scrollbar.m_SpriteButtonTop = attr_value; 1755 1750 else if (attr_name == "sprite_button_top_pressed") 1756 1751 scrollbar.m_SpriteButtonTopPressed = attr_value; 1757 1752 else if (attr_name == "sprite_button_top_disabled") … … void CGUI::Xeromyces_ReadScrollBarStyle( 1772 1767 scrollbar.m_SpriteBarVertical = attr_value; 1773 1768 else if (attr_name == "sprite_bar_vertical_over") 1774 1769 scrollbar.m_SpriteBarVerticalOver = attr_value; 1775 1770 else if (attr_name == "sprite_bar_vertical_pressed") 1776 1771 scrollbar.m_SpriteBarVerticalPressed = attr_value; 1777 }1778 1772 1779 // 1780 // Add to CGUI 1781 // 1773 // Horizontal scrollbar style 1774 else if (attr_name == "sprite_button_left") 1775 scrollbar.m_SpriteButtonTop = attr_value; 1776 else if (attr_name == "sprite_button_left_pressed") 1777 scrollbar.m_SpriteButtonTopPressed = attr_value; 1778 else if (attr_name == "sprite_button_left_disabled") 1779 scrollbar.m_SpriteButtonTopDisabled = attr_value; 1780 else if (attr_name == "sprite_button_left_over") 1781 scrollbar.m_SpriteButtonTopOver = attr_value; 1782 else if (attr_name == "sprite_button_right") 1783 scrollbar.m_SpriteButtonBottom = attr_value; 1784 else if (attr_name == "sprite_button_right_pressed") 1785 scrollbar.m_SpriteButtonBottomPressed = attr_value; 1786 else if (attr_name == "sprite_button_right_disabled") 1787 scrollbar.m_SpriteButtonBottomDisabled = attr_value; 1788 else if (attr_name == "sprite_button_right_over") 1789 scrollbar.m_SpriteButtonBottomOver = attr_value; 1790 else if (attr_name == "sprite_back_horizontal") 1791 scrollbar.m_SpriteBackVertical = attr_value; 1792 else if (attr_name == "sprite_bar_horizontal") 1793 scrollbar.m_SpriteBarVertical = attr_value; 1794 else if (attr_name == "sprite_bar_horizontal_over") 1795 scrollbar.m_SpriteBarVerticalOver = attr_value; 1796 else if (attr_name == "sprite_bar_horizontal_pressed") 1797 scrollbar.m_SpriteBarVerticalPressed = attr_value; 1798 } 1782 1799 1783 1800 m_ScrollBarStyles[name] = scrollbar; 1784 1801 } 1785 1802 1786 1803 void CGUI::Xeromyces_ReadIcon(XMBElement Element, CXeromyces* pFile) -
source/gui/CGUIScrollBarVertical.cpp
void CGUIScrollBarVertical::SetPosFromMo 50 50 51 51 void CGUIScrollBarVertical::Draw() 52 52 { 53 53 if (!GetStyle()) 54 54 { 55 LOGWARNING("Attempt to draw scrollbar without a style.");55 LOGWARNING("Attempt to draw a vertical scrollbar without a style."); 56 56 return; 57 57 } 58 58 59 59 if (GetGUI() && IsVisible()) 60 60 { -
source/gui/CGUIScrollBarVertical.h
1 /* Copyright (C) 201 5Wildfire Games.1 /* Copyright (C) 2016 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify 5 5 * it under the terms of the GNU General Public License as published by 6 6 * the Free Software Foundation, either version 2 of the License, or … … 14 14 * You should have received a copy of the GNU General Public License 15 15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 17 18 18 /* 19 A GUI ScrollBar20 21 --Overview--22 23 19 A GUI Scrollbar, this class doesn't present all functionality 24 20 to the scrollbar, it just controls the drawing and a wrapper 25 21 for interaction with it. 26 27 --Usage--28 29 Used in everywhere scrollbars are needed, like in a combobox for instance.30 31 --More info--32 33 Check GUI.h34 35 22 */ 36 23 37 24 #ifndef INCLUDED_CGUISCROLLBARVERTICAL 38 25 #define INCLUDED_CGUISCROLLBARVERTICAL 39 26 … … class CGUIScrollBarVertical : public IGU 50 37 public: 51 38 CGUIScrollBarVertical(); 52 39 virtual ~CGUIScrollBarVertical(); 53 40 54 41 public: 55 /** 56 * Draw the scroll-bar 57 */ 42 58 43 virtual void Draw(); 59 44 60 45 /** 61 46 * If an object that contains a scrollbar has got messages, send 62 47 * them to the scroll-bar and it will see if the message regarded … … public: 69 54 /** 70 55 * Set m_Pos with g_mouse_x/y input, i.e. when dragging. 71 56 */ 72 57 virtual void SetPosFromMousePos(const CPos& mouse); 73 58 74 /**75 * @see IGUIScrollBar#HoveringButtonMinus76 */77 59 virtual bool HoveringButtonMinus(const CPos& mouse); 78 79 /**80 * @see IGUIScrollBar#HoveringButtonPlus81 */82 60 virtual bool HoveringButtonPlus(const CPos& mouse); 83 61 84 /**85 * Set Right Aligned86 * @param align Alignment87 */88 62 void SetRightAligned(const bool& align) { m_RightAligned = align; } 89 63 90 64 /** 91 65 * Get the rectangle of the actual BAR. 92 * @return Rectangle, CRect93 66 */ 94 67 virtual CRect GetBarRect() const; 95 68 96 69 /** 97 70 * Get the rectangle of the outline of the scrollbar, every component of the 98 71 * scroll-bar should be inside this area. 99 * @return Rectangle, CRect100 72 */ 101 73 virtual CRect GetOuterRect() const; 102 74 103 75 protected: 104 76 /** -
source/gui/CInput.cpp
CInput::CInput() 52 52 AddSetting(GUIST_CStrW, "font"); 53 53 AddSetting(GUIST_CStrW, "mask_char"); 54 54 AddSetting(GUIST_bool, "mask"); 55 55 AddSetting(GUIST_int, "max_length"); 56 56 AddSetting(GUIST_bool, "multiline"); 57 AddSetting(GUIST_bool, "scrollbar ");57 AddSetting(GUIST_bool, "scrollbar_vertical"); 58 58 AddSetting(GUIST_CStr, "scrollbar_style"); 59 59 AddSetting(GUIST_CGUISpriteInstance, "sprite"); 60 60 AddSetting(GUIST_CGUISpriteInstance, "sprite_selectarea"); 61 61 AddSetting(GUIST_CColor, "textcolor"); 62 62 AddSetting(GUIST_CColor, "textcolor_selected"); … … void CInput::HandleMessage(SGUIMessage& 783 783 784 784 switch (Message.type) 785 785 { 786 786 case GUIM_SETTINGS_UPDATED: 787 787 { 788 bool scrollbar ;789 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);788 bool scrollbar_vertical; 789 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 790 790 791 791 // Update scroll-bar 792 792 // TODO Gee: (2004-09-01) Is this really updated each time it should? 793 if (scrollbar &&793 if (scrollbar_vertical && 794 794 (Message.value == CStr("size") || 795 795 Message.value == CStr("z") || 796 796 Message.value == CStr("absolute"))) 797 797 { 798 798 GetScrollBar(0).SetX(m_CachedActualSize.right); … … void CInput::HandleMessage(SGUIMessage& 819 819 if (Message.value == CStr("size") || 820 820 Message.value == CStr("z") || 821 821 Message.value == CStr("font") || 822 822 Message.value == CStr("absolute") || 823 823 Message.value == CStr("caption") || 824 Message.value == CStr("scrollbar ") ||824 Message.value == CStr("scrollbar_vertical") || 825 825 Message.value == CStr("scrollbar_style")) 826 826 { 827 827 UpdateText(); 828 828 } 829 829 … … void CInput::HandleMessage(SGUIMessage& 842 842 break; 843 843 } 844 844 845 845 case GUIM_MOUSE_PRESS_LEFT: 846 846 { 847 bool scrollbar , multiline;848 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);847 bool scrollbar_vertical, multiline; 848 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 849 849 GUI<bool>::GetSetting(this, "multiline", multiline); 850 850 851 851 // Check if we're selecting the scrollbar 852 852 if (GetScrollBar(0).GetStyle() && multiline) 853 853 { … … void CInput::UpdateCachedSize() 1067 1067 // If an ancestor's size changed, this will let us intercept the change and 1068 1068 // update our scrollbar positions 1069 1069 1070 1070 IGUIObject::UpdateCachedSize(); 1071 1071 1072 bool scrollbar ;1073 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);1074 if (scrollbar )1072 bool scrollbar_vertical; 1073 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 1074 if (scrollbar_vertical) 1075 1075 { 1076 1076 GetScrollBar(0).SetX(m_CachedActualSize.right); 1077 1077 GetScrollBar(0).SetY(m_CachedActualSize.top); 1078 1078 GetScrollBar(0).SetZ(GetBufferedZ()); 1079 1079 GetScrollBar(0).SetLength(m_CachedActualSize.bottom - m_CachedActualSize.top); … … void CInput::Draw() 1099 1099 // should always be visible 1100 1100 m_CursorVisState = true; 1101 1101 } 1102 1102 1103 1103 // First call draw on ScrollBarOwner 1104 bool scrollbar ;1104 bool scrollbar_vertical; 1105 1105 float buffer_zone; 1106 1106 bool multiline; 1107 1107 bool mask; 1108 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);1108 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 1109 1109 GUI<float>::GetSetting(this, "buffer_zone", buffer_zone); 1110 1110 GUI<bool>::GetSetting(this, "multiline", multiline); 1111 1111 GUI<bool>::GetSetting(this, "mask", mask); 1112 1112 1113 if (scrollbar && multiline)1113 if (scrollbar_vertical && multiline) 1114 1114 IGUIScrollBarOwner::Draw(); 1115 1115 1116 1116 if (!GetGUI()) 1117 1117 return; 1118 1118 … … void CInput::Draw() 1147 1147 GUI<int>::GetSetting(this, "cell_id", cell_id); 1148 1148 1149 1149 GetGUI()->DrawSprite(*sprite, cell_id, bz, m_CachedActualSize); 1150 1150 1151 1151 float scroll = 0.f; 1152 if (scrollbar && multiline)1152 if (scrollbar_vertical && multiline) 1153 1153 scroll = GetScrollBar(0).GetPos(); 1154 1154 1155 1155 CFontMetrics font(font_name); 1156 1156 1157 1157 // We'll have to setup clipping manually, since we're doing the rendering manually. 1158 1158 CRect cliparea(m_CachedActualSize); 1159 1159 1160 1160 // First we'll figure out the clipping area, which is the cached actual size 1161 1161 // substracted by an optional scrollbar 1162 if (scrollbar )1162 if (scrollbar_vertical) 1163 1163 { 1164 1164 scroll = GetScrollBar(0).GetPos(); 1165 1165 1166 1166 // substract scrollbar from cliparea 1167 1167 if (cliparea.right > GetScrollBar(0).GetOuterRect().left && … … void CInput::UpdateText(int from, int to 1832 1832 } 1833 1833 1834 1834 // add the final row (even if empty) 1835 1835 m_CharacterPositions.insert(current_line, row); 1836 1836 1837 bool scrollbar ;1838 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);1837 bool scrollbar_vertical; 1838 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 1839 1839 // Update scollbar 1840 if (scrollbar )1840 if (scrollbar_vertical) 1841 1841 { 1842 1842 GetScrollBar(0).SetScrollRange(m_CharacterPositions.size() * font.GetLineSpacing() + buffer_zone*2.f); 1843 1843 GetScrollBar(0).SetScrollSpace(m_CachedActualSize.GetHeight()); 1844 1844 } 1845 1845 } … … int CInput::GetMouseHoveringTextPosition 1862 1862 CPos mouse = GetMousePos(); 1863 1863 1864 1864 if (multiline) 1865 1865 { 1866 1866 CStrW font_name_w; 1867 bool scrollbar ;1867 bool scrollbar_vertical; 1868 1868 GUI<CStrW>::GetSetting(this, "font", font_name_w); 1869 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);1869 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 1870 1870 CStrIntern font_name(font_name_w.ToUTF8()); 1871 1871 1872 1872 float scroll = 0.f; 1873 if (scrollbar )1873 if (scrollbar_vertical) 1874 1874 scroll = GetScrollBarPos(0); 1875 1875 1876 1876 // Now get the height of the font. 1877 1877 // TODO: Get the real font 1878 1878 CFontMetrics font(font_name); … … bool CInput::SelectingText() const 1985 1985 m_iBufferPos_Tail != m_iBufferPos; 1986 1986 } 1987 1987 1988 1988 float CInput::GetTextAreaWidth() 1989 1989 { 1990 bool scrollbar ;1990 bool scrollbar_vertical; 1991 1991 float buffer_zone; 1992 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);1992 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 1993 1993 GUI<float>::GetSetting(this, "buffer_zone", buffer_zone); 1994 1994 1995 if (scrollbar && GetScrollBar(0).GetStyle())1995 if (scrollbar_vertical && GetScrollBar(0).GetStyle()) 1996 1996 return m_CachedActualSize.GetWidth() - buffer_zone*2.f - GetScrollBar(0).GetStyle()->m_Width; 1997 1997 else 1998 1998 return m_CachedActualSize.GetWidth() - buffer_zone*2.f; 1999 1999 } 2000 2000 … … void CInput::UpdateAutoScroll() 2007 2007 2008 2008 // Autoscrolling up and down 2009 2009 if (multiline) 2010 2010 { 2011 2011 CStrW font_name_w; 2012 bool scrollbar ;2012 bool scrollbar_vertical; 2013 2013 GUI<CStrW>::GetSetting(this, "font", font_name_w); 2014 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);2014 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 2015 2015 CStrIntern font_name(font_name_w.ToUTF8()); 2016 2016 2017 2017 float scroll = 0.f; 2018 if (!scrollbar )2018 if (!scrollbar_vertical) 2019 2019 return; 2020 2020 2021 2021 scroll = GetScrollBar(0).GetPos(); 2022 2022 2023 2023 // Now get the height of the font. -
source/gui/CList.cpp
CList::CList() 31 31 { 32 32 // Add sprite_disabled! TODO 33 33 34 34 AddSetting(GUIST_float, "buffer_zone"); 35 35 AddSetting(GUIST_CStrW, "font"); 36 AddSetting(GUIST_bool, "scrollbar ");36 AddSetting(GUIST_bool, "scrollbar_vertical"); 37 37 AddSetting(GUIST_CStr, "scrollbar_style"); 38 38 AddSetting(GUIST_CStrW, "sound_disabled"); 39 39 AddSetting(GUIST_CStrW, "sound_selected"); 40 40 AddSetting(GUIST_CGUISpriteInstance, "sprite"); 41 41 AddSetting(GUIST_CGUISpriteInstance, "sprite_selectarea"); … … CList::CList() 48 48 AddSetting(GUIST_CStr, "tooltip_style"); 49 49 // Each list item has both a name (in 'list') and an associated data string (in 'list_data') 50 50 AddSetting(GUIST_CGUIList, "list"); 51 51 AddSetting(GUIST_CGUIList, "list_data"); // TODO: this should be a list of raw strings, not of CGUIStrings 52 52 53 GUI<bool>::SetSetting(this, "scrollbar ", false);53 GUI<bool>::SetSetting(this, "scrollbar_vertical", false); 54 54 55 55 // Nothing is selected as default. 56 56 GUI<int>::SetSetting(this, "selected", -1); 57 57 58 58 // Add scroll-bar … … void CList::SetupText() 89 89 if (GUI<CStrW>::GetSetting(this, "font", font) != PSRETURN_OK || font.empty()) 90 90 // Use the default if none is specified 91 91 // TODO Gee: (2004-08-14) Don't define standard like this. Do it with the default style. 92 92 font = L"default"; 93 93 94 bool scrollbar ;95 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);94 bool scrollbar_vertical; 95 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 96 96 97 97 float width = GetListRect().GetWidth(); 98 98 // remove scrollbar if applicable 99 if (scrollbar && GetScrollBar(0).GetStyle())99 if (scrollbar_vertical && GetScrollBar(0).GetStyle()) 100 100 width -= GetScrollBar(0).GetStyle()->m_Width; 101 101 102 102 float buffer_zone = 0.f; 103 103 GUI<float>::GetSetting(this, "buffer_zone", buffer_zone); 104 104 … … void CList::SetupText() 118 118 AddText(text); 119 119 } 120 120 121 121 m_ItemsYPositions[pList->m_Items.size()] = buffered_y; 122 122 123 // Setup scrollbar 124 if (scrollbar) 123 if (scrollbar_vertical) 125 124 { 126 125 GetScrollBar(0).SetScrollRange(m_ItemsYPositions.back()); 127 126 GetScrollBar(0).SetScrollSpace(GetListRect().GetHeight()); 128 127 129 128 CRect rect = GetListRect(); … … void CList::HandleMessage(SGUIMessage& M 153 152 154 153 // TODO only works if lower-case, shouldn't it be made case sensitive instead? 155 154 ScriptEvent("selectionchange"); 156 155 } 157 156 158 if (Message.value == "scrollbar ")157 if (Message.value == "scrollbar_vertical") 159 158 SetupText(); 160 159 161 // Update scrollbar162 160 if (Message.value == "scrollbar_style") 163 161 { 164 162 CStr scrollbar_style; 165 163 GUI<CStr>::GetSetting(this, Message.value, scrollbar_style); 166 164 … … void CList::HandleMessage(SGUIMessage& M 181 179 if (g_SoundManager && GUI<CStrW>::GetSetting(this, "sound_disabled", soundPath) == PSRETURN_OK && !soundPath.empty()) 182 180 g_SoundManager->PlayAsUI(soundPath.c_str(), false); 183 181 break; 184 182 } 185 183 186 bool scrollbar ;184 bool scrollbar_vertical; 187 185 CGUIList* pList; 188 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);186 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 189 187 GUI<CGUIList>::GetSettingPointer(this, "list", pList); 190 188 float scroll = 0.f; 191 if (scrollbar )189 if (scrollbar_vertical) 192 190 scroll = GetScrollBar(0).GetPos(); 193 191 194 192 CRect rect = GetListRect(); 195 193 CPos mouse = GetMousePos(); 196 194 mouse.y += scroll; … … void CList::HandleMessage(SGUIMessage& M 198 196 for (int i = 0; i < (int)pList->m_Items.size(); ++i) 199 197 { 200 198 if (mouse.y >= rect.top + m_ItemsYPositions[i] && 201 199 mouse.y < rect.top + m_ItemsYPositions[i+1] && 202 200 // mouse is not over scroll-bar 203 (!scrollbar || !GetScrollBar(0).IsVisible() ||201 (!scrollbar_vertical || !GetScrollBar(0).IsVisible() || 204 202 mouse.x < GetScrollBar(0).GetOuterRect().left || 205 203 mouse.x > GetScrollBar(0).GetOuterRect().right)) 206 204 { 207 205 set = i; 208 206 } … … void CList::Draw() 303 301 void CList::DrawList(const int& selected, const CStr& _sprite, const CStr& _sprite_selected, const CStr& _textcolor) 304 302 { 305 303 float bz = GetBufferedZ(); 306 304 307 305 // First call draw on ScrollBarOwner 308 bool scrollbar ;309 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);306 bool scrollbar_vertical; 307 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 310 308 311 if (scrollbar )309 if (scrollbar_vertical) 312 310 IGUIScrollBarOwner::Draw(); 313 311 314 312 if (GetGUI()) 315 313 { 316 314 CRect rect = GetListRect(); … … void CList::DrawList(const int& selected 326 324 GUI<CGUIList>::GetSettingPointer(this, "list", pList); 327 325 328 326 GetGUI()->DrawSprite(*sprite, cell_id, bz, rect); 329 327 330 328 float scroll = 0.f; 331 if (scrollbar )329 if (scrollbar_vertical) 332 330 scroll = GetScrollBar(0).GetPos(); 333 331 334 332 if (selected >= 0 && selected+1 < (int)m_ItemsYPositions.size()) 335 333 { 336 334 // Get rectangle of selection: … … void CList::DrawList(const int& selected 343 341 if (rect_sel.bottom > rect.bottom) 344 342 rect_sel.bottom = rect.bottom; 345 343 if (rect_sel.top < rect.top) 346 344 rect_sel.top = rect.top; 347 345 348 if (scrollbar )346 if (scrollbar_vertical) 349 347 { 350 348 // Remove any overlapping area of the scrollbar. 351 349 if (rect_sel.right > GetScrollBar(0).GetOuterRect().left && 352 350 rect_sel.right <= GetScrollBar(0).GetOuterRect().right) 353 351 rect_sel.right = GetScrollBar(0).GetOuterRect().left; … … void CList::DrawList(const int& selected 371 369 continue; 372 370 373 371 // Clipping area (we'll have to substract the scrollbar) 374 372 CRect cliparea = GetListRect(); 375 373 376 if (scrollbar )374 if (scrollbar_vertical) 377 375 { 378 376 if (cliparea.right > GetScrollBar(0).GetOuterRect().left && 379 377 cliparea.right <= GetScrollBar(0).GetOuterRect().right) 380 378 cliparea.right = GetScrollBar(0).GetOuterRect().left; 381 379 … … void CList::SelectLastElement() 478 476 } 479 477 480 478 void CList::UpdateAutoScroll() 481 479 { 482 480 int selected; 483 bool scrollbar ;481 bool scrollbar_vertical; 484 482 float scroll; 485 483 GUI<int>::GetSetting(this, "selected", selected); 486 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);484 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 487 485 488 486 CRect rect = GetListRect(); 489 487 490 488 // No scrollbar, no scrolling (at least it's not made to work properly). 491 if (!scrollbar )489 if (!scrollbar_vertical) 492 490 return; 493 491 494 492 scroll = GetScrollBar(0).GetPos(); 495 493 496 494 // Check upper boundary -
source/gui/COList.cpp
void COList::SetupText() 63 63 if (GUI<CStrW>::GetSetting(this, "font", font) != PSRETURN_OK || font.empty()) 64 64 // Use the default if none is specified 65 65 // TODO Gee: (2004-08-14) Don't define standard like this. Do it with the default style. 66 66 font = L"default"; 67 67 68 bool scrollbar ;69 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);68 bool scrollbar_vertical; 69 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 70 70 71 71 float width = GetListRect().GetWidth(); 72 72 // remove scrollbar if applicable 73 if (scrollbar && GetScrollBar(0).GetStyle())73 if (scrollbar_vertical && GetScrollBar(0).GetStyle()) 74 74 width -= GetScrollBar(0).GetStyle()->m_Width; 75 75 76 76 m_TotalAvalibleColumnWidth = width; 77 77 78 78 float buffer_zone = 0.f; … … void COList::SetupText() 121 121 } 122 122 } 123 123 124 124 m_ItemsYPositions[pList->m_Items.size()] = buffered_y; 125 125 126 if (scrollbar )126 if (scrollbar_vertical) 127 127 { 128 128 GetScrollBar(0).SetScrollRange(m_ItemsYPositions.back()); 129 129 GetScrollBar(0).SetScrollSpace(GetListRect().GetHeight()); 130 130 131 131 CRect rect = GetListRect(); … … bool COList::HandleAdditionalChildren(co 297 297 298 298 void COList::DrawList(const int& selected, const CStr& _sprite, const CStr& _sprite_selected, const CStr& _textcolor) 299 299 { 300 300 float bz = GetBufferedZ(); 301 301 302 bool scrollbar ;303 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);302 bool scrollbar_vertical; 303 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 304 304 305 if (scrollbar )305 if (scrollbar_vertical) 306 306 IGUIScrollBarOwner::Draw(); 307 307 308 308 if (!GetGUI()) 309 309 return; 310 310 … … void COList::DrawList(const int& selecte 321 321 GUI<CGUIList>::GetSettingPointer(this, "list_name", pList); 322 322 323 323 GetGUI()->DrawSprite(*sprite, cell_id, bz, rect); 324 324 325 325 float scroll = 0.f; 326 if (scrollbar )326 if (scrollbar_vertical) 327 327 scroll = GetScrollBar(0).GetPos(); 328 328 329 329 // Draw item selection 330 330 if (selected != -1) 331 331 { … … void COList::DrawList(const int& selecte 341 341 if (rect_sel.bottom > rect.bottom) 342 342 rect_sel.bottom = rect.bottom; 343 343 if (rect_sel.top < rect.top) 344 344 rect_sel.top = rect.top; 345 345 346 if (scrollbar )346 if (scrollbar_vertical) 347 347 { 348 348 // Remove any overlapping area of the scrollbar. 349 349 if (rect_sel.right > GetScrollBar(0).GetOuterRect().left && 350 350 rect_sel.right <= GetScrollBar(0).GetOuterRect().right) 351 351 rect_sel.right = GetScrollBar(0).GetOuterRect().left; … … void COList::DrawList(const int& selecte 415 415 const float rowHeight = m_ItemsYPositions[i+1] - m_ItemsYPositions[i]; 416 416 417 417 // Clipping area (we'll have to substract the scrollbar) 418 418 CRect cliparea = GetListRect(); 419 419 420 if (scrollbar )420 if (scrollbar_vertical) 421 421 { 422 422 if (cliparea.right > GetScrollBar(0).GetOuterRect().left && 423 423 cliparea.right <= GetScrollBar(0).GetOuterRect().right) 424 424 cliparea.right = GetScrollBar(0).GetOuterRect().left; 425 425 -
source/gui/CText.cpp
CText::CText() 29 29 AddSetting(GUIST_float, "buffer_zone"); 30 30 AddSetting(GUIST_CGUIString, "caption"); 31 31 AddSetting(GUIST_int, "cell_id"); 32 32 AddSetting(GUIST_bool, "clip"); 33 33 AddSetting(GUIST_CStrW, "font"); 34 AddSetting(GUIST_bool, "scrollbar ");34 AddSetting(GUIST_bool, "scrollbar_vertical"); 35 35 AddSetting(GUIST_CStr, "scrollbar_style"); 36 36 AddSetting(GUIST_bool, "scroll_bottom"); 37 37 AddSetting(GUIST_CGUISpriteInstance, "sprite"); 38 38 AddSetting(GUIST_EAlign, "text_align"); 39 39 AddSetting(GUIST_EVAlign, "text_valign"); … … CText::CText() 44 44 // Private settings 45 45 AddSetting(GUIST_CStrW, "_icon_tooltip"); 46 46 AddSetting(GUIST_CStr, "_icon_tooltip_style"); 47 47 48 48 //GUI<bool>::SetSetting(this, "ghost", true); 49 GUI<bool>::SetSetting(this, "scrollbar ", false);49 GUI<bool>::SetSetting(this, "scrollbar_vertical", false); 50 50 GUI<bool>::SetSetting(this, "clip", true); 51 51 52 52 // Add scroll-bar 53 53 CGUIScrollBarVertical* bar = new CGUIScrollBarVertical(); 54 54 bar->SetRightAligned(true); … … void CText::SetupText() 74 74 // Use the default if none is specified 75 75 // TODO Gee: (2004-08-14) Don't define standard like this. Do it with the default style. 76 76 font = L"default"; 77 77 78 78 CGUIString caption; 79 bool scrollbar ;79 bool scrollbar_vertical; 80 80 GUI<CGUIString>::GetSetting(this, "caption", caption); 81 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);81 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 82 82 83 83 float width = m_CachedActualSize.GetWidth(); 84 84 // remove scrollbar if applicable 85 if (scrollbar && GetScrollBar(0).GetStyle())85 if (scrollbar_vertical && GetScrollBar(0).GetStyle()) 86 86 width -= GetScrollBar(0).GetStyle()->m_Width; 87 87 88 88 89 89 float buffer_zone = 0.f; 90 90 GUI<float>::GetSetting(this, "buffer_zone", buffer_zone); 91 91 *m_GeneratedTexts[0] = GetGUI()->GenerateText(caption, font, width, buffer_zone, this); 92 92 93 if (!scrollbar )93 if (!scrollbar_vertical) 94 94 CalculateTextPosition(m_CachedActualSize, m_TextPos, *m_GeneratedTexts[0]); 95 95 96 // Setup scrollbar 97 if (scrollbar) 96 if (scrollbar_vertical) 98 97 { 99 98 bool scrollbottom = false; 100 99 GUI<bool>::GetSetting(this, "scroll_bottom", scrollbottom); 101 100 102 101 // If we are currently scrolled to the bottom of the text, … … void CText::HandleMessage(SGUIMessage& M 126 125 //IGUITextOwner::HandleMessage(Message); <== placed it after the switch instead! 127 126 128 127 switch (Message.type) 129 128 { 130 129 case GUIM_SETTINGS_UPDATED: 131 if (Message.value == "scrollbar ")130 if (Message.value == "scrollbar_vertical") //TODO: correct? 132 131 SetupText(); 133 132 134 // Update scrollbar135 133 if (Message.value == "scrollbar_style") 136 134 { 137 135 CStr scrollbar_style; 138 136 GUI<CStr>::GetSetting(this, Message.value, scrollbar_style); 139 137 … … void CText::HandleMessage(SGUIMessage& M 185 183 void CText::Draw() 186 184 { 187 185 float bz = GetBufferedZ(); 188 186 189 187 // First call draw on ScrollBarOwner 190 bool scrollbar ;191 GUI<bool>::GetSetting(this, "scrollbar ", scrollbar);188 bool scrollbar_vertical; 189 GUI<bool>::GetSetting(this, "scrollbar_vertical", scrollbar_vertical); 192 190 193 if (scrollbar) 194 // Draw scrollbar 191 if (scrollbar_vertical) 195 192 IGUIScrollBarOwner::Draw(); 196 193 197 194 if (!GetGUI()) 198 195 return; 199 196 … … void CText::Draw() 205 202 GUI<bool>::GetSetting(this, "clip", clip); 206 203 207 204 GetGUI()->DrawSprite(*sprite, cell_id, bz, m_CachedActualSize); 208 205 209 206 float scroll = 0.f; 210 if (scrollbar )207 if (scrollbar_vertical) 211 208 scroll = GetScrollBar(0).GetPos(); 212 209 213 210 // Clipping area (we'll have to subtract the scrollbar) 214 211 CRect cliparea; 215 212 if (clip) 216 213 { 217 214 cliparea = m_CachedActualSize; 218 215 219 if (scrollbar )216 if (scrollbar_vertical) 220 217 { 221 218 // subtract scrollbar from cliparea 222 219 if (cliparea.right > GetScrollBar(0).GetOuterRect().left && 223 220 cliparea.right <= GetScrollBar(0).GetOuterRect().right) 224 221 cliparea.right = GetScrollBar(0).GetOuterRect().left; … … void CText::Draw() 230 227 } 231 228 232 229 CColor color; 233 230 GUI<CColor>::GetSetting(this, "textcolor", color); 234 231 235 if (scrollbar )232 if (scrollbar_vertical) 236 233 DrawText(0, color, m_CachedActualSize.TopLeft() - CPos(0.f, scroll), bz+0.1f, cliparea); 237 234 else 238 235 DrawText(0, color, m_TextPos, bz+0.1f, cliparea); 239 236 } 240 237 -
source/gui/IGUIScrollBar.h
struct SGUIScrollBarStyle 125 125 //@{ 126 126 127 127 CGUISpriteInstance m_SpriteButtonLeft; 128 128 CGUISpriteInstance m_SpriteButtonLeftPressed; 129 129 CGUISpriteInstance m_SpriteButtonLeftDisabled; 130 CGUISpriteInstance m_SpriteButtonLeftOver; 130 131 131 132 CGUISpriteInstance m_SpriteButtonRight; 132 133 CGUISpriteInstance m_SpriteButtonRightPressed; 133 134 CGUISpriteInstance m_SpriteButtonRightDisabled; 135 CGUISpriteInstance m_SpriteButtonRightOver; 134 136 135 CGUISpriteInstance m_SpriteBackHorizontal;136 137 CGUISpriteInstance m_SpriteBarHorizontal; 138 CGUISpriteInstance m_SpriteBarHorizontalOver; 139 CGUISpriteInstance m_SpriteBarHorizontalPressed; 137 140 141 CGUISpriteInstance m_SpriteBackHorizontal; 138 142 //@} 139 143 }; 140 144 141 145 142 146 /**