mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-08-06 06:55:34 +00:00
Toolbar placement fix
This commit is contained in:
parent
857615ab00
commit
b7a1ea6251
@ -137,6 +137,8 @@ void Button::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button,
|
||||
|
||||
void Button::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
if (m_pressed && m_hovered)
|
||||
Log.report(LogVisor::Info, "button '%s' activated", m_textStr.c_str());
|
||||
m_pressed = false;
|
||||
if (m_hovered)
|
||||
setHover();
|
||||
@ -181,7 +183,7 @@ void Button::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
m_bBlockBuf->load(&m_bBlock, sizeof(ViewBlock));
|
||||
float pf = rootView().window()->getVirtualPixelFactor();
|
||||
textRect.location[0] += 5 * pf;
|
||||
textRect.location[1] = 11 * pf;
|
||||
textRect.location[1] += 8 * pf;
|
||||
m_text->resized(root, textRect);
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ RootView::RootView(ViewResources& res, boo::IWindow* window)
|
||||
MultiLineTextView* textView1 = new MultiLineTextView(res, *this, res.m_heading18);
|
||||
space1->setContentView(std::unique_ptr<MultiLineTextView>(textView1));
|
||||
Space* space2 = new Space(res, *m_splitView, Toolbar::Position::Bottom);
|
||||
space2->toolbar().push_back(std::make_unique<Button>(res, space2->toolbar(), "こんにちはボタン"));
|
||||
MultiLineTextView* textView2 = new MultiLineTextView(res, *this, res.m_heading18);
|
||||
space2->setContentView(std::unique_ptr<MultiLineTextView>(textView2));
|
||||
m_splitView->setContentView(0, std::unique_ptr<Space>(space1));
|
||||
|
@ -59,12 +59,13 @@ Toolbar::Toolbar(ViewResources& res, View& parentView, Position tbPos)
|
||||
void Toolbar::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
||||
{
|
||||
boo::SWindowRect childRect = subRect();
|
||||
int subLoc1 = childRect.location[1];
|
||||
for (Child& c : m_children)
|
||||
{
|
||||
childRect.size[0] = c.m_view->nominalWidth();
|
||||
childRect.size[1] = c.m_view->nominalHeight();
|
||||
childRect.location[0] += m_padding;
|
||||
childRect.location[1] = (m_gauge - childRect.size[1]) / 2 - 1;
|
||||
childRect.location[1] = subLoc1 + (m_gauge - childRect.size[1]) / 2;
|
||||
if (childRect.coordInRect(coord))
|
||||
{
|
||||
if (!c.m_mouseDown)
|
||||
@ -92,12 +93,13 @@ void Toolbar::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button,
|
||||
void Toolbar::mouseMove(const boo::SWindowCoord& coord)
|
||||
{
|
||||
boo::SWindowRect childRect = subRect();
|
||||
int subLoc1 = childRect.location[1];
|
||||
for (Child& c : m_children)
|
||||
{
|
||||
childRect.size[0] = c.m_view->nominalWidth();
|
||||
childRect.size[1] = c.m_view->nominalHeight();
|
||||
childRect.location[0] += m_padding;
|
||||
childRect.location[1] = (m_gauge - childRect.size[1]) / 2 - 1;
|
||||
childRect.location[1] = subLoc1 + (m_gauge - childRect.size[1]) / 2;
|
||||
if (childRect.coordInRect(coord))
|
||||
{
|
||||
if (!c.m_mouseIn)
|
||||
@ -157,7 +159,7 @@ void Toolbar::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
||||
childRect.size[0] = c.m_view->nominalWidth();
|
||||
childRect.size[1] = c.m_view->nominalHeight();
|
||||
childRect.location[0] += m_padding;
|
||||
childRect.location[1] = (m_gauge - childRect.size[1]) / 2 - 1;
|
||||
childRect.location[1] = sub.location[1] + (m_gauge - childRect.size[1]) / 2;
|
||||
c.m_view->resized(root, childRect);
|
||||
childRect.location[0] += childRect.size[0];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user