mirror of https://github.com/AxioDL/metaforce.git
Initial Menu preparation
This commit is contained in:
parent
54a5abc921
commit
531dafdc68
|
@ -18,22 +18,59 @@ public:
|
|||
|
||||
private:
|
||||
Style m_style;
|
||||
IButtonBinding::MenuStyle m_menuStyle = IButtonBinding::MenuStyle::None;
|
||||
Zeus::CColor m_textColor;
|
||||
std::string m_textStr;
|
||||
std::unique_ptr<TextView> m_text;
|
||||
|
||||
SolidShaderVert m_verts[28];
|
||||
SolidShaderVert m_verts[40];
|
||||
VertexBufferBinding m_vertsBinding;
|
||||
|
||||
RectangleConstraint m_constraint;
|
||||
int m_nomWidth, m_nomHeight;
|
||||
bool m_pressed = false;
|
||||
bool m_hovered = false;
|
||||
int m_textWidth;
|
||||
|
||||
void setInactive();
|
||||
void setHover();
|
||||
void setPressed();
|
||||
void setDisabled();
|
||||
struct ButtonTarget : View
|
||||
{
|
||||
Button& m_button;
|
||||
|
||||
bool m_pressed = false;
|
||||
bool m_hovered = false;
|
||||
|
||||
void setInactive();
|
||||
void setHover();
|
||||
void setPressed();
|
||||
void setDisabled();
|
||||
|
||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
ButtonTarget(ViewResources& res, Button& button) : View(res, button), m_button(button) {}
|
||||
};
|
||||
ViewChild<std::unique_ptr<ButtonTarget>> m_buttonTarget;
|
||||
|
||||
struct MenuTarget : View
|
||||
{
|
||||
Button& m_button;
|
||||
|
||||
bool m_pressed = false;
|
||||
bool m_hovered = false;
|
||||
|
||||
void setInactive();
|
||||
void setHover();
|
||||
void setPressed();
|
||||
void setDisabled();
|
||||
|
||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
MenuTarget(ViewResources& res, Button& button) : View(res, button), m_button(button) {}
|
||||
};
|
||||
ViewChild<std::unique_ptr<MenuTarget>> m_menuTarget;
|
||||
|
||||
ViewChild<std::unique_ptr<View>> m_modalMenu;
|
||||
|
||||
public:
|
||||
class Resources
|
||||
|
@ -53,7 +90,7 @@ public:
|
|||
RectangleConstraint constraint=RectangleConstraint());
|
||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseMove(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define SPECTER_CONTROL_HPP
|
||||
|
||||
#include "View.hpp"
|
||||
#include "HECL/CVar.hpp"
|
||||
|
||||
namespace Specter
|
||||
{
|
||||
|
@ -26,6 +25,20 @@ struct IButtonBinding : IControlBinding
|
|||
|
||||
/** Pass-through up action */
|
||||
virtual void up(const Button* button, const boo::SWindowCoord& coord) {}
|
||||
|
||||
/** Optional style of menu to bind to button */
|
||||
enum class MenuStyle
|
||||
{
|
||||
None, /**< No menu; normal button */
|
||||
Primary, /**< Menu button replaces normal button */
|
||||
Auxiliary /**< Menu button placed alongside normal button */
|
||||
};
|
||||
|
||||
/** Informs button which MenuStyle to present to user */
|
||||
virtual MenuStyle menuStyle(const Specter::Button* button) const {return MenuStyle::None;}
|
||||
|
||||
/** Called when user requests menu, Button assumes modal ownership */
|
||||
virtual std::unique_ptr<View> buildMenu(const Specter::Button* button) {return std::unique_ptr<View>();}
|
||||
};
|
||||
|
||||
struct IFloatBinding : IControlBinding
|
||||
|
@ -63,12 +76,6 @@ protected:
|
|||
IControlBinding* m_controlBinding = nullptr;
|
||||
public:
|
||||
Control(ViewResources& res, View& parentView, IControlBinding* controlBinding);
|
||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
|
||||
IControlBinding* setControlBinding(IControlBinding* controlBinding);
|
||||
};
|
||||
|
||||
class ITextInputView : public Control, public boo::ITextInputCallback
|
||||
|
|
|
@ -317,8 +317,10 @@ public:
|
|||
const HECL::SystemString& initialPath,
|
||||
std::function<void(bool, const HECL::SystemString&)> returnFunc);
|
||||
|
||||
static std::vector<HECL::SystemString> PathComponents(const HECL::SystemString& path);
|
||||
static void SyncBookmarkSelections(Table& table, BookmarkDataBind& binding,
|
||||
const HECL::SystemString& sel);
|
||||
|
||||
void navigateToPath(const HECL::SystemString& path);
|
||||
bool showingHidden() const {return m_showingHidden;}
|
||||
void setShowingHidden(bool showingHidden)
|
||||
|
|
|
@ -1,4 +1,78 @@
|
|||
#ifndef SPECTER_MENU_HPP
|
||||
#define SPECTER_MENU_HPP
|
||||
|
||||
#include "View.hpp"
|
||||
#include "TextView.hpp"
|
||||
#include "ScrollView.hpp"
|
||||
|
||||
namespace Specter
|
||||
{
|
||||
|
||||
struct IMenuNode
|
||||
{
|
||||
virtual boo::ITexture* icon() const {return nullptr;}
|
||||
virtual const std::string* text() const {return nullptr;}
|
||||
virtual size_t subNodeCount() const {return 0;}
|
||||
virtual IMenuNode* subNode(size_t idx) {return nullptr;}
|
||||
virtual void activated() {}
|
||||
};
|
||||
|
||||
class Menu : public View
|
||||
{
|
||||
IMenuNode* m_rootNode;
|
||||
IMenuNode* m_thisNode;
|
||||
std::unique_ptr<Menu> m_subMenu;
|
||||
std::unique_ptr<TextView> m_headText;
|
||||
|
||||
int m_cWidth, m_cHeight;
|
||||
|
||||
SolidShaderVert m_verts[16];
|
||||
VertexBufferBinding m_vertsBinding;
|
||||
|
||||
struct ContentView : View
|
||||
{
|
||||
ContentView(ViewResources& res, Menu& menu) : View(res, menu) {}
|
||||
|
||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseMove(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
std::unique_ptr<ContentView> m_content;
|
||||
ViewChild<std::unique_ptr<ScrollView>> m_scroll;
|
||||
|
||||
struct ItemView : View
|
||||
{
|
||||
Menu& m_menu;
|
||||
std::unique_ptr<TextView> m_textView;
|
||||
ItemView(ViewResources& res, Menu& menu, const std::string& text);
|
||||
|
||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseEnter(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
};
|
||||
std::vector<ViewChild<std::unique_ptr<ItemView>>> m_items;
|
||||
|
||||
Menu(ViewResources& res, View& parentView, IMenuNode* rootNode, IMenuNode* thisNode);
|
||||
|
||||
public:
|
||||
Menu(ViewResources& res, View& parentView, IMenuNode* rootNode);
|
||||
void reset(IMenuNode* rootNode);
|
||||
|
||||
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
||||
void mouseMove(const boo::SWindowCoord&);
|
||||
void mouseLeave(const boo::SWindowCoord&);
|
||||
void scroll(const boo::SWindowCoord&, const boo::SScrollDelta&);
|
||||
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SPECTER_MENU_HPP
|
||||
|
|
|
@ -8,10 +8,7 @@ namespace Specter
|
|||
{
|
||||
class ModalWindow : public View
|
||||
{
|
||||
int m_frame = 0;
|
||||
int m_contentStartFrame = 0;
|
||||
float m_lineTime = 0.0;
|
||||
|
||||
public:
|
||||
enum class Phase
|
||||
{
|
||||
BuildIn,
|
||||
|
@ -19,7 +16,14 @@ class ModalWindow : public View
|
|||
Showing,
|
||||
BuildOut,
|
||||
Done
|
||||
} m_phase = Phase::BuildIn;
|
||||
};
|
||||
|
||||
private:
|
||||
int m_frame = 0;
|
||||
int m_contentStartFrame = 0;
|
||||
float m_lineTime = 0.0;
|
||||
|
||||
Phase m_phase = Phase::BuildIn;
|
||||
|
||||
int m_width = 0;
|
||||
int m_height = 0;
|
||||
|
@ -64,6 +68,7 @@ public:
|
|||
bool skipBuildInAnimation();
|
||||
void close(bool skipAnimation=false);
|
||||
bool closed() const {return m_phase >= Phase::BuildOut;}
|
||||
ModalWindow::Phase phase() const {return m_phase;}
|
||||
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#ifndef SPECTER_SCROLLVIEW_HPP
|
||||
#define SPECTER_SCROLLVIEW_HPP
|
||||
|
||||
#include "View.hpp"
|
||||
#include "Button.hpp"
|
||||
#include "IViewManager.hpp"
|
||||
|
||||
namespace Specter
|
||||
{
|
||||
class ViewResources;
|
||||
class Button;
|
||||
|
||||
class ScrollView : public View
|
||||
{
|
||||
|
@ -49,7 +49,10 @@ private:
|
|||
m_leftName(vm.translateOr("scroll_left", "Scroll Left")),
|
||||
m_rightName(vm.translateOr("scroll_right", "Scroll Right")) {}
|
||||
const char* name(const Control* control) const
|
||||
{return (control == m_sv.m_sideButtons[0].m_view.get()) ? m_leftName.c_str() : m_rightName.c_str();}
|
||||
{
|
||||
return (control == reinterpret_cast<Control*>(m_sv.m_sideButtons[0].m_view.get())) ?
|
||||
m_leftName.c_str() : m_rightName.c_str();
|
||||
}
|
||||
void down(const Button* button, const boo::SWindowCoord& coord)
|
||||
{
|
||||
if (button == m_sv.m_sideButtons[0].m_view.get())
|
||||
|
@ -65,17 +68,7 @@ private:
|
|||
ViewChild<std::unique_ptr<Button>> m_sideButtons[2];
|
||||
|
||||
bool _scroll(const boo::SScrollDelta& scroll);
|
||||
|
||||
int scrollAreaWidth() const
|
||||
{
|
||||
int ret = subRect().size[0];
|
||||
if (m_style == Style::SideButtons && m_drawSideButtons)
|
||||
{
|
||||
ret -= m_sideButtons[0].m_view->nominalWidth();
|
||||
ret -= m_sideButtons[1].m_view->nominalWidth();
|
||||
}
|
||||
return std::max(0, ret);
|
||||
}
|
||||
int scrollAreaWidth() const;
|
||||
|
||||
public:
|
||||
ScrollView(ViewResources& res, View& parentView, Style style);
|
||||
|
@ -97,17 +90,7 @@ public:
|
|||
int nominalWidth() const {return subRect().size[0];}
|
||||
int nominalHeight() const {return subRect().size[1];}
|
||||
|
||||
void setMultiplyColor(const Zeus::CColor& color)
|
||||
{
|
||||
View::setMultiplyColor(color);
|
||||
if (m_style == Style::SideButtons)
|
||||
{
|
||||
m_sideButtons[0].m_view->setMultiplyColor(color);
|
||||
m_sideButtons[1].m_view->setMultiplyColor(color);
|
||||
}
|
||||
if (m_contentView.m_view)
|
||||
m_contentView.m_view->setMultiplyColor(color);
|
||||
}
|
||||
void setMultiplyColor(const Zeus::CColor& color);
|
||||
|
||||
void think();
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
|
|
|
@ -23,9 +23,12 @@ Button::Button(ViewResources& res, View& parentView,
|
|||
: Control(res, parentView, controlBinding),
|
||||
m_style(style), m_textColor(textColor), m_textStr(text), m_constraint(constraint)
|
||||
{
|
||||
m_vertsBinding.initSolid(res, 28, m_viewVertBlockBuf);
|
||||
m_vertsBinding.initSolid(res, 40, m_viewVertBlockBuf);
|
||||
commitResources(res);
|
||||
|
||||
m_buttonTarget.m_view.reset(new ButtonTarget(res, *this));
|
||||
m_menuTarget.m_view.reset(new MenuTarget(res, *this));
|
||||
|
||||
if (style == Style::Block)
|
||||
{
|
||||
m_verts[0].m_color = res.themeData().button1Inactive();
|
||||
|
@ -35,14 +38,20 @@ Button::Button(ViewResources& res, View& parentView,
|
|||
m_verts[4].m_color = res.themeData().button2Inactive();
|
||||
for (int i=5 ; i<28 ; ++i)
|
||||
m_verts[i].m_color = res.themeData().button2Inactive();
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 28);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
m_verts[i].m_color = Zeus::CColor::skClear;
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 4);
|
||||
for (int i=31 ; i<35 ; ++i)
|
||||
m_verts[i].m_color = Zeus::CColor::skClear;
|
||||
}
|
||||
for (int i=28 ; i<31 ; ++i)
|
||||
m_verts[i].m_color = m_textColor;
|
||||
m_vertsBinding.load(m_verts, sizeof(m_verts));
|
||||
|
||||
if (controlBinding)
|
||||
m_menuStyle = controlBinding->menuStyle(this);
|
||||
|
||||
m_text.reset(new TextView(res, *this, res.m_mainFont, TextView::Alignment::Center));
|
||||
setText(m_textStr);
|
||||
|
@ -60,7 +69,7 @@ void Button::setText(const std::string& text, const Zeus::CColor& textColor)
|
|||
|
||||
m_text->typesetGlyphs(text, textColor);
|
||||
float pf = rootView().viewRes().pixelFactor();
|
||||
float width, height;
|
||||
int width, height;
|
||||
|
||||
if (m_style == Style::Block)
|
||||
{
|
||||
|
@ -100,7 +109,9 @@ void Button::setText(const std::string& text, const Zeus::CColor& textColor)
|
|||
m_verts[26].m_pos.assign(width+1, 1, 0);
|
||||
m_verts[27].m_pos.assign(width+1, 0, 0);
|
||||
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 28);
|
||||
m_textWidth = width;
|
||||
|
||||
m_vertsBinding.load(m_verts, sizeof(m_verts));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -111,7 +122,30 @@ void Button::setText(const std::string& text, const Zeus::CColor& textColor)
|
|||
m_verts[2].m_pos.assign(width, -1*pf, 0);
|
||||
m_verts[3].m_pos.assign(width, -2*pf, 0);
|
||||
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 4);
|
||||
int arrowX = width + 5*pf;
|
||||
m_verts[28].m_pos.assign(arrowX + 4*pf, 1*pf, 0);
|
||||
m_verts[29].m_pos.assign(arrowX, 5*pf, 0);
|
||||
m_verts[30].m_pos.assign(arrowX + 8*pf, 5*pf, 0);
|
||||
|
||||
m_textWidth = width;
|
||||
|
||||
int arrowLineWidth = 7*pf;
|
||||
if (m_menuStyle != IButtonBinding::MenuStyle::None)
|
||||
{
|
||||
width += 13*pf;
|
||||
if (m_menuStyle == IButtonBinding::MenuStyle::Primary)
|
||||
{
|
||||
arrowLineWidth = width;
|
||||
arrowX = 1*pf;
|
||||
}
|
||||
}
|
||||
|
||||
m_verts[31].m_pos.assign(arrowX, -1*pf, 0);
|
||||
m_verts[32].m_pos.assign(arrowX, -2*pf, 0);
|
||||
m_verts[33].m_pos.assign(arrowX + arrowLineWidth, -1*pf, 0);
|
||||
m_verts[34].m_pos.assign(arrowX + arrowLineWidth, -2*pf, 0);
|
||||
|
||||
m_vertsBinding.load(m_verts, sizeof(m_verts));
|
||||
}
|
||||
|
||||
m_nomWidth = width;
|
||||
|
@ -124,109 +158,222 @@ void Button::colorGlyphs(const Zeus::CColor& newColor)
|
|||
m_text->colorGlyphs(newColor);
|
||||
}
|
||||
|
||||
void Button::setInactive()
|
||||
void Button::ButtonTarget::setInactive()
|
||||
{
|
||||
if (m_style == Style::Block)
|
||||
if (m_button.m_style == Style::Block)
|
||||
{
|
||||
m_verts[0].m_color = rootView().themeData().button1Inactive();
|
||||
m_verts[1].m_color = rootView().themeData().button2Inactive();
|
||||
m_verts[2].m_color = rootView().themeData().button1Inactive();
|
||||
m_verts[3].m_color = rootView().themeData().button2Inactive();
|
||||
m_verts[4].m_color = rootView().themeData().button2Inactive();
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 28);
|
||||
m_button.m_verts[0].m_color = rootView().themeData().button1Inactive();
|
||||
m_button.m_verts[1].m_color = rootView().themeData().button2Inactive();
|
||||
m_button.m_verts[2].m_color = rootView().themeData().button1Inactive();
|
||||
m_button.m_verts[3].m_color = rootView().themeData().button2Inactive();
|
||||
m_button.m_verts[4].m_color = rootView().themeData().button2Inactive();
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
m_verts[i].m_color = Zeus::CColor::skClear;
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 4);
|
||||
m_text->colorGlyphs(m_textColor);
|
||||
m_button.m_verts[i].m_color = Zeus::CColor::skClear;
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
m_button.m_text->colorGlyphs(m_button.m_textColor);
|
||||
}
|
||||
}
|
||||
|
||||
void Button::setHover()
|
||||
void Button::MenuTarget::setInactive()
|
||||
{
|
||||
if (m_style == Style::Block)
|
||||
if (m_button.m_style == Style::Block)
|
||||
{
|
||||
m_verts[0].m_color = rootView().themeData().button1Hover();
|
||||
m_verts[1].m_color = rootView().themeData().button2Hover();
|
||||
m_verts[2].m_color = rootView().themeData().button1Hover();
|
||||
m_verts[3].m_color = rootView().themeData().button2Hover();
|
||||
m_verts[4].m_color = rootView().themeData().button2Hover();
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 28);
|
||||
m_button.m_verts[28].m_color = rootView().themeData().button1Inactive();
|
||||
m_button.m_verts[29].m_color = rootView().themeData().button2Inactive();
|
||||
m_button.m_verts[30].m_color = rootView().themeData().button1Inactive();
|
||||
m_button.m_verts[31].m_color = rootView().themeData().button2Inactive();
|
||||
m_button.m_verts[32].m_color = rootView().themeData().button2Inactive();
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
m_verts[i].m_color = m_textColor;
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 4);
|
||||
m_text->colorGlyphs(m_textColor);
|
||||
for (int i=28 ; i<31 ; ++i)
|
||||
m_button.m_verts[i].m_color = m_button.m_textColor;
|
||||
for (int i=31 ; i<35 ; ++i)
|
||||
m_button.m_verts[i].m_color = Zeus::CColor::skClear;
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
}
|
||||
|
||||
void Button::setPressed()
|
||||
void Button::ButtonTarget::setHover()
|
||||
{
|
||||
if (m_style == Style::Block)
|
||||
if (m_button.m_style == Style::Block)
|
||||
{
|
||||
m_verts[0].m_color = rootView().themeData().button1Press();
|
||||
m_verts[1].m_color = rootView().themeData().button2Press();
|
||||
m_verts[2].m_color = rootView().themeData().button1Press();
|
||||
m_verts[3].m_color = rootView().themeData().button2Press();
|
||||
m_verts[4].m_color = rootView().themeData().button2Press();
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 28);
|
||||
m_button.m_verts[0].m_color = rootView().themeData().button1Hover();
|
||||
m_button.m_verts[1].m_color = rootView().themeData().button2Hover();
|
||||
m_button.m_verts[2].m_color = rootView().themeData().button1Hover();
|
||||
m_button.m_verts[3].m_color = rootView().themeData().button2Hover();
|
||||
m_button.m_verts[4].m_color = rootView().themeData().button2Hover();
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
m_verts[i].m_color = m_textColor;
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 4);
|
||||
m_text->colorGlyphs(m_textColor);
|
||||
m_button.m_verts[i].m_color = m_button.m_textColor;
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
m_button.m_text->colorGlyphs(m_button.m_textColor);
|
||||
}
|
||||
}
|
||||
|
||||
void Button::setDisabled()
|
||||
void Button::MenuTarget::setHover()
|
||||
{
|
||||
if (m_style == Style::Block)
|
||||
if (m_button.m_style == Style::Block)
|
||||
{
|
||||
m_verts[0].m_color = rootView().themeData().button1Disabled();
|
||||
m_verts[1].m_color = rootView().themeData().button2Disabled();
|
||||
m_verts[2].m_color = rootView().themeData().button1Disabled();
|
||||
m_verts[3].m_color = rootView().themeData().button2Disabled();
|
||||
m_verts[4].m_color = rootView().themeData().button2Disabled();
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 28);
|
||||
m_button.m_verts[28].m_color = rootView().themeData().button1Hover();
|
||||
m_button.m_verts[29].m_color = rootView().themeData().button2Hover();
|
||||
m_button.m_verts[30].m_color = rootView().themeData().button1Hover();
|
||||
m_button.m_verts[31].m_color = rootView().themeData().button2Hover();
|
||||
m_button.m_verts[32].m_color = rootView().themeData().button2Hover();
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=28 ; i<31 ; ++i)
|
||||
m_button.m_verts[i].m_color = m_button.m_textColor;
|
||||
for (int i=31 ; i<35 ; ++i)
|
||||
m_button.m_verts[i].m_color = m_button.m_textColor;
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
}
|
||||
|
||||
void Button::ButtonTarget::setPressed()
|
||||
{
|
||||
if (m_button.m_style == Style::Block)
|
||||
{
|
||||
m_button.m_verts[0].m_color = rootView().themeData().button1Press();
|
||||
m_button.m_verts[1].m_color = rootView().themeData().button2Press();
|
||||
m_button.m_verts[2].m_color = rootView().themeData().button1Press();
|
||||
m_button.m_verts[3].m_color = rootView().themeData().button2Press();
|
||||
m_button.m_verts[4].m_color = rootView().themeData().button2Press();
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
m_verts[i].m_color = Zeus::CColor::skClear;
|
||||
m_vertsBinding.load(m_verts, sizeof(SolidShaderVert) * 4);
|
||||
Zeus::CColor dimText = m_textColor;
|
||||
m_button.m_verts[i].m_color = m_button.m_textColor;
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
m_button.m_text->colorGlyphs(m_button.m_textColor);
|
||||
}
|
||||
}
|
||||
|
||||
void Button::MenuTarget::setPressed()
|
||||
{
|
||||
if (m_button.m_style == Style::Block)
|
||||
{
|
||||
m_button.m_verts[28].m_color = rootView().themeData().button1Press();
|
||||
m_button.m_verts[29].m_color = rootView().themeData().button2Press();
|
||||
m_button.m_verts[30].m_color = rootView().themeData().button1Press();
|
||||
m_button.m_verts[31].m_color = rootView().themeData().button2Press();
|
||||
m_button.m_verts[32].m_color = rootView().themeData().button2Press();
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=28 ; i<31 ; ++i)
|
||||
m_button.m_verts[i].m_color = m_button.m_textColor;
|
||||
for (int i=31 ; i<35 ; ++i)
|
||||
m_button.m_verts[i].m_color = m_button.m_textColor;
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
}
|
||||
|
||||
void Button::ButtonTarget::setDisabled()
|
||||
{
|
||||
if (m_button.m_style == Style::Block)
|
||||
{
|
||||
m_button.m_verts[0].m_color = rootView().themeData().button1Disabled();
|
||||
m_button.m_verts[1].m_color = rootView().themeData().button2Disabled();
|
||||
m_button.m_verts[2].m_color = rootView().themeData().button1Disabled();
|
||||
m_button.m_verts[3].m_color = rootView().themeData().button2Disabled();
|
||||
m_button.m_verts[4].m_color = rootView().themeData().button2Disabled();
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
m_button.m_verts[i].m_color = Zeus::CColor::skClear;
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
Zeus::CColor dimText = m_button.m_textColor;
|
||||
dimText[3] *= 0.5;
|
||||
m_text->colorGlyphs(dimText);
|
||||
m_button.m_text->colorGlyphs(dimText);
|
||||
}
|
||||
}
|
||||
|
||||
void Button::MenuTarget::setDisabled()
|
||||
{
|
||||
if (m_button.m_style == Style::Block)
|
||||
{
|
||||
m_button.m_verts[28].m_color = rootView().themeData().button1Disabled();
|
||||
m_button.m_verts[29].m_color = rootView().themeData().button2Disabled();
|
||||
m_button.m_verts[30].m_color = rootView().themeData().button1Disabled();
|
||||
m_button.m_verts[31].m_color = rootView().themeData().button2Disabled();
|
||||
m_button.m_verts[32].m_color = rootView().themeData().button2Disabled();
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
else
|
||||
{
|
||||
Zeus::CColor dimText = m_button.m_textColor;
|
||||
dimText[3] *= 0.5;
|
||||
for (int i=28 ; i<31 ; ++i)
|
||||
m_button.m_verts[i].m_color = dimText;
|
||||
for (int i=31 ; i<35 ; ++i)
|
||||
m_button.m_verts[i].m_color = Zeus::CColor::skClear;
|
||||
m_button.m_vertsBinding.load(m_button.m_verts, sizeof(m_button.m_verts));
|
||||
}
|
||||
}
|
||||
|
||||
void Button::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
Control::mouseDown(coord, button, mod);
|
||||
if (m_menuStyle != IButtonBinding::MenuStyle::Primary)
|
||||
m_buttonTarget.mouseDown(coord, button, mod);
|
||||
m_menuTarget.mouseDown(coord, button, mod);
|
||||
}
|
||||
|
||||
void Button::ButtonTarget::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
m_pressed = true;
|
||||
setPressed();
|
||||
if (m_controlBinding && dynamic_cast<IButtonBinding*>(m_controlBinding))
|
||||
static_cast<IButtonBinding&>(*m_controlBinding).down(this, coord);
|
||||
if (m_button.m_controlBinding)
|
||||
static_cast<IButtonBinding&>(*m_button.m_controlBinding).down(&m_button, coord);
|
||||
}
|
||||
|
||||
void Button::MenuTarget::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
m_pressed = true;
|
||||
setPressed();
|
||||
if (m_hovered)
|
||||
{
|
||||
Log.report(LogVisor::Info, "button menu '%s' activated", m_button.m_textStr.c_str());
|
||||
if (m_button.m_controlBinding)
|
||||
{
|
||||
m_button.m_modalMenu.m_view = static_cast<IButtonBinding&>(*m_button.m_controlBinding).buildMenu(&m_button);
|
||||
updateSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Button::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
Control::mouseUp(coord, button, mod);
|
||||
if (m_menuStyle != IButtonBinding::MenuStyle::Primary)
|
||||
m_buttonTarget.mouseUp(coord, button, mod);
|
||||
m_menuTarget.mouseUp(coord, button, mod);
|
||||
}
|
||||
|
||||
void Button::ButtonTarget::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
if (m_pressed)
|
||||
{
|
||||
if (m_controlBinding && dynamic_cast<IButtonBinding*>(m_controlBinding))
|
||||
static_cast<IButtonBinding&>(*m_controlBinding).up(this, coord);
|
||||
if (m_button.m_controlBinding)
|
||||
static_cast<IButtonBinding&>(*m_button.m_controlBinding).up(&m_button, coord);
|
||||
if (m_hovered)
|
||||
{
|
||||
Log.report(LogVisor::Info, "button '%s' activated", m_textStr.c_str());
|
||||
if (m_controlBinding && dynamic_cast<IButtonBinding*>(m_controlBinding))
|
||||
static_cast<IButtonBinding&>(*m_controlBinding).activated(this, coord);
|
||||
Log.report(LogVisor::Info, "button '%s' activated", m_button.m_textStr.c_str());
|
||||
if (m_button.m_controlBinding)
|
||||
static_cast<IButtonBinding&>(*m_button.m_controlBinding).activated(&m_button, coord);
|
||||
}
|
||||
m_pressed = false;
|
||||
}
|
||||
|
@ -236,9 +383,33 @@ void Button::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, b
|
|||
setInactive();
|
||||
}
|
||||
|
||||
void Button::mouseEnter(const boo::SWindowCoord& coord)
|
||||
void Button::MenuTarget::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
m_pressed = false;
|
||||
if (m_hovered)
|
||||
setHover();
|
||||
else
|
||||
setInactive();
|
||||
}
|
||||
|
||||
void Button::mouseMove(const boo::SWindowCoord& coord)
|
||||
{
|
||||
if (m_menuStyle != IButtonBinding::MenuStyle::Primary)
|
||||
m_buttonTarget.mouseMove(coord);
|
||||
m_menuTarget.mouseMove(coord);
|
||||
}
|
||||
|
||||
void Button::ButtonTarget::mouseEnter(const boo::SWindowCoord& coord)
|
||||
{
|
||||
m_hovered = true;
|
||||
if (m_pressed)
|
||||
setPressed();
|
||||
else
|
||||
setHover();
|
||||
}
|
||||
|
||||
void Button::MenuTarget::mouseEnter(const boo::SWindowCoord& coord)
|
||||
{
|
||||
Control::mouseEnter(coord);
|
||||
m_hovered = true;
|
||||
if (m_pressed)
|
||||
setPressed();
|
||||
|
@ -248,7 +419,19 @@ void Button::mouseEnter(const boo::SWindowCoord& coord)
|
|||
|
||||
void Button::mouseLeave(const boo::SWindowCoord& coord)
|
||||
{
|
||||
Control::mouseLeave(coord);
|
||||
if (m_menuStyle != IButtonBinding::MenuStyle::Primary)
|
||||
m_buttonTarget.mouseLeave(coord);
|
||||
m_menuTarget.mouseLeave(coord);
|
||||
}
|
||||
|
||||
void Button::ButtonTarget::mouseLeave(const boo::SWindowCoord& coord)
|
||||
{
|
||||
m_hovered = false;
|
||||
setInactive();
|
||||
}
|
||||
|
||||
void Button::MenuTarget::mouseLeave(const boo::SWindowCoord& coord)
|
||||
{
|
||||
m_hovered = false;
|
||||
setInactive();
|
||||
}
|
||||
|
@ -260,10 +443,38 @@ void Button::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
|||
float pf = rootView().viewRes().pixelFactor();
|
||||
if (m_style == Style::Block)
|
||||
textRect.location[1] += 7 * pf;
|
||||
textRect.location[0] += m_nomWidth / 2;
|
||||
textRect.size[0] = m_nomWidth;
|
||||
textRect.location[0] += m_textWidth / 2;
|
||||
textRect.size[0] = m_textWidth;
|
||||
textRect.size[1] = m_nomHeight;
|
||||
m_text->resized(root, textRect);
|
||||
|
||||
if (m_style == Style::Block)
|
||||
{
|
||||
m_buttonTarget.m_view->resized(root, sub);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_menuStyle == IButtonBinding::MenuStyle::Primary)
|
||||
{
|
||||
boo::SWindowRect targetRect = sub;
|
||||
targetRect.size[0] = m_nomWidth;
|
||||
targetRect.size[1] = m_nomHeight;
|
||||
m_menuTarget.m_view->resized(root, targetRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
boo::SWindowRect targetRect = sub;
|
||||
targetRect.size[0] = m_textWidth + 3*pf;
|
||||
targetRect.size[1] = m_nomHeight;
|
||||
m_buttonTarget.m_view->resized(root, targetRect);
|
||||
targetRect.location[0] += targetRect.size[0];
|
||||
targetRect.size[0] = 15*pf;
|
||||
m_menuTarget.m_view->resized(root, targetRect);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_modalMenu.m_view)
|
||||
m_modalMenu.m_view->resized(root, sub);
|
||||
}
|
||||
|
||||
void Button::draw(boo::IGraphicsCommandQueue* gfxQ)
|
||||
|
@ -274,8 +485,18 @@ void Button::draw(boo::IGraphicsCommandQueue* gfxQ)
|
|||
if (m_style == Style::Block)
|
||||
gfxQ->draw(0, 28);
|
||||
else
|
||||
{
|
||||
gfxQ->draw(0, 4);
|
||||
if (m_menuStyle != IButtonBinding::MenuStyle::None)
|
||||
{
|
||||
gfxQ->draw(28, 3);
|
||||
gfxQ->draw(31, 4);
|
||||
}
|
||||
}
|
||||
m_text->draw(gfxQ);
|
||||
|
||||
if (m_modalMenu.m_view)
|
||||
m_modalMenu.m_view->draw(gfxQ);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,29 +6,6 @@ namespace Specter
|
|||
Control::Control(ViewResources& res, View& parentView,
|
||||
IControlBinding* controlBinding)
|
||||
: View(res, parentView), m_controlBinding(controlBinding) {}
|
||||
|
||||
IControlBinding* Control::setControlBinding(IControlBinding* controlBinding)
|
||||
{
|
||||
IControlBinding* ret = m_controlBinding;
|
||||
m_controlBinding = controlBinding;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Control::mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey)
|
||||
{
|
||||
}
|
||||
|
||||
void Control::mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey)
|
||||
{
|
||||
}
|
||||
|
||||
void Control::mouseEnter(const boo::SWindowCoord&)
|
||||
{
|
||||
}
|
||||
|
||||
void Control::mouseLeave(const boo::SWindowCoord&)
|
||||
{
|
||||
}
|
||||
|
||||
std::recursive_mutex ITextInputView::m_textInputLk;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ static LogVisor::LogModule Log("Specter::FileBrowser");
|
|||
#define BROWSER_MIN_WIDTH 600
|
||||
#define BROWSER_MIN_HEIGHT 300
|
||||
|
||||
static std::vector<HECL::SystemString> PathComponents(const HECL::SystemString& path)
|
||||
std::vector<HECL::SystemString> FileBrowser::PathComponents(const HECL::SystemString& path)
|
||||
{
|
||||
std::vector<HECL::SystemString> ret;
|
||||
HECL::SystemString sPath = path;
|
||||
|
|
|
@ -0,0 +1,168 @@
|
|||
#include "Specter/Menu.hpp"
|
||||
#include "Specter/RootView.hpp"
|
||||
#include "Specter/ViewResources.hpp"
|
||||
|
||||
namespace Specter
|
||||
{
|
||||
|
||||
Menu::Menu(ViewResources& res, View& parentView, IMenuNode* rootNode)
|
||||
: View(res, parentView)
|
||||
{
|
||||
m_vertsBinding.initSolid(res, 16, m_viewVertBlockBuf);
|
||||
commitResources(res);
|
||||
m_headText.reset(new TextView(res, *this, res.m_mainFont));
|
||||
m_scroll.m_view.reset(new ScrollView(res, *this, ScrollView::Style::ThinIndicator));
|
||||
m_content.reset(new ContentView(res, *this));
|
||||
m_scroll.m_view->setContentView(m_content.get());
|
||||
reset(rootNode);
|
||||
}
|
||||
|
||||
void Menu::reset(IMenuNode* rootNode)
|
||||
{
|
||||
m_rootNode = rootNode;
|
||||
m_thisNode = rootNode;
|
||||
ViewResources& res = rootView().viewRes();
|
||||
|
||||
for (int i=0 ; i<16 ; ++i)
|
||||
m_verts[i].m_color = res.themeData().tooltipBackground();
|
||||
m_vertsBinding.load(m_verts, sizeof(m_verts));
|
||||
setBackground(Zeus::CColor::skBlue);
|
||||
|
||||
m_subMenu.reset();
|
||||
|
||||
const std::string* headText = rootNode->text();
|
||||
m_headText->typesetGlyphs(headText?*headText:"", rootView().themeData().uiText());
|
||||
|
||||
float pf = rootView().viewRes().pixelFactor();
|
||||
m_cWidth = m_headText->nominalWidth() + 10*pf;
|
||||
m_cHeight = 22*pf;
|
||||
|
||||
size_t subCount = rootNode->subNodeCount();
|
||||
m_items.clear();
|
||||
if (subCount)
|
||||
{
|
||||
m_items.reserve(subCount);
|
||||
for (size_t i=0 ; i<subCount ; ++i)
|
||||
{
|
||||
IMenuNode* node = rootNode->subNode(i);
|
||||
const std::string* nodeText = node->text();
|
||||
|
||||
m_items.emplace_back();
|
||||
ViewChild<std::unique_ptr<ItemView>>& item = m_items.back();
|
||||
|
||||
if (nodeText)
|
||||
{
|
||||
item.m_view.reset(new ItemView(res, *this, *nodeText));
|
||||
m_cWidth = std::max(m_cWidth, int(item.m_view->m_textView->nominalWidth() + 10*pf));
|
||||
}
|
||||
|
||||
m_cHeight += 22*pf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Menu::Menu(ViewResources& res, View& parentView, IMenuNode* rootNode, IMenuNode* thisNode)
|
||||
: View(res, parentView), m_rootNode(rootNode), m_thisNode(thisNode)
|
||||
{
|
||||
m_vertsBinding.initSolid(res, 16, m_viewVertBlockBuf);
|
||||
commitResources(res);
|
||||
m_headText.reset(new TextView(res, *this, res.m_mainFont));
|
||||
m_scroll.m_view.reset(new ScrollView(res, *this, ScrollView::Style::ThinIndicator));
|
||||
m_content.reset(new ContentView(res, *this));
|
||||
m_scroll.m_view->setContentView(m_content.get());
|
||||
}
|
||||
|
||||
Menu::ItemView::ItemView(ViewResources& res, Menu& menu, const std::string& text)
|
||||
: View(res, menu), m_menu(menu)
|
||||
{
|
||||
commitResources(res);
|
||||
m_textView.reset(new Specter::TextView(res, *this, res.m_mainFont));
|
||||
m_textView->typesetGlyphs(text, res.themeData().uiText());
|
||||
}
|
||||
|
||||
void Menu::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::ContentView::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::ItemView::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::ContentView::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::ItemView::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::mouseMove(const boo::SWindowCoord& coord)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::ContentView::mouseMove(const boo::SWindowCoord& coord)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::ItemView::mouseEnter(const boo::SWindowCoord& coord)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::mouseLeave(const boo::SWindowCoord& coord)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::ContentView::mouseLeave(const boo::SWindowCoord& coord)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::ItemView::mouseLeave(const boo::SWindowCoord& coord)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Menu::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
boo::SWindowRect rect = sub;
|
||||
View::resized(root, rect);
|
||||
}
|
||||
|
||||
void Menu::ContentView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
{
|
||||
}
|
||||
|
||||
void Menu::draw(boo::IGraphicsCommandQueue* gfxQ)
|
||||
{
|
||||
View::draw(gfxQ);
|
||||
}
|
||||
|
||||
void Menu::ContentView::draw(boo::IGraphicsCommandQueue* gfxQ)
|
||||
{
|
||||
View::draw(gfxQ);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
#include "Specter/MessageWindow.hpp"
|
||||
#include "Specter/ViewResources.hpp"
|
||||
#include "Specter/RootView.hpp"
|
||||
#include "Specter/Menu.hpp"
|
||||
|
||||
namespace Specter
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "Specter/ScrollView.hpp"
|
||||
#include "Specter/ViewResources.hpp"
|
||||
#include "Specter/RootView.hpp"
|
||||
#include "Specter/Button.hpp"
|
||||
|
||||
namespace Specter
|
||||
{
|
||||
|
@ -84,6 +85,17 @@ bool ScrollView::_scroll(const boo::SScrollDelta& scroll)
|
|||
return false;
|
||||
}
|
||||
|
||||
int ScrollView::scrollAreaWidth() const
|
||||
{
|
||||
int ret = subRect().size[0];
|
||||
if (m_style == Style::SideButtons && m_drawSideButtons)
|
||||
{
|
||||
ret -= m_sideButtons[0].m_view->nominalWidth();
|
||||
ret -= m_sideButtons[1].m_view->nominalWidth();
|
||||
}
|
||||
return std::max(0, ret);
|
||||
}
|
||||
|
||||
void ScrollView::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
if (m_style == Style::SideButtons && m_drawSideButtons)
|
||||
|
@ -157,6 +169,18 @@ void ScrollView::scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta&
|
|||
updateSize();
|
||||
}
|
||||
|
||||
void ScrollView::setMultiplyColor(const Zeus::CColor& color)
|
||||
{
|
||||
View::setMultiplyColor(color);
|
||||
if (m_style == Style::SideButtons)
|
||||
{
|
||||
m_sideButtons[0].m_view->setMultiplyColor(color);
|
||||
m_sideButtons[1].m_view->setMultiplyColor(color);
|
||||
}
|
||||
if (m_contentView.m_view)
|
||||
m_contentView.m_view->setMultiplyColor(color);
|
||||
}
|
||||
|
||||
void ScrollView::think()
|
||||
{
|
||||
m_consecutiveIdx = (m_consecutiveIdx+1) % 16;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "Specter/Table.hpp"
|
||||
#include "Specter/ViewResources.hpp"
|
||||
#include "Specter/RootView.hpp"
|
||||
#include "Specter/ScrollView.hpp"
|
||||
|
||||
namespace Specter
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue