mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-21 06:40:37 +01:00
[code] Larger console button in MenuController.
Change-Id: Ia8a495d4de95a4a9d6fee698975b2c7e831c4c43
This commit is contained in:
@@ -8,13 +8,14 @@ ButtonRowDelegate::ButtonRowDelegate(ButtonRowController * header, ButtonRowCont
|
||||
{
|
||||
}
|
||||
|
||||
ButtonRowController::ContentView::ContentView(ViewController * mainViewController, ButtonRowDelegate * delegate, Position position, Style style) :
|
||||
ButtonRowController::ContentView::ContentView(ViewController * mainViewController, ButtonRowDelegate * delegate, Position position, Style style, Size size) :
|
||||
View(),
|
||||
m_mainViewController(mainViewController),
|
||||
m_selectedButton(-1),
|
||||
m_delegate(delegate),
|
||||
m_position(position),
|
||||
m_style(style)
|
||||
m_style(style),
|
||||
m_size(size)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -51,7 +52,12 @@ void ButtonRowController::ContentView::layoutSubviews() {
|
||||
m_mainViewController->view()->setFrame(mainViewFrame);
|
||||
return;
|
||||
}
|
||||
KDCoordinate rowHeight = m_style == Style::PlainWhite ? k_plainStyleHeight : k_embossedStyleHeight;
|
||||
KDCoordinate rowHeight;
|
||||
if (m_style == Style::PlainWhite) {
|
||||
rowHeight = k_plainStyleHeight;
|
||||
} else {
|
||||
rowHeight = m_size == Size::Small ? k_embossedStyleHeightSmall : k_embossedStyleHeightLarge;
|
||||
}
|
||||
KDCoordinate frameOrigin = m_position == Position::Top ? rowHeight+1 : 0;
|
||||
KDRect mainViewFrame(0, frameOrigin, bounds().width(), bounds().height() - rowHeight - 1);
|
||||
m_mainViewController->view()->setFrame(mainViewFrame);
|
||||
@@ -68,8 +74,8 @@ void ButtonRowController::ContentView::layoutSubviews() {
|
||||
totalButtonWidth += button->minimalSizeForOptimalDisplay().width();
|
||||
}
|
||||
widthMargin = std::round((float)((bounds().width() - totalButtonWidth)/(nbOfButtons+1)));
|
||||
buttonHeightMargin = k_embossedStyleHeightMargin;
|
||||
buttonHeight = rowHeight- 2*k_embossedStyleHeightMargin;
|
||||
buttonHeightMargin = m_size == Size::Small ? k_embossedStyleHeightMarginSmall : k_embossedStyleHeightMarginLarge;
|
||||
buttonHeight = rowHeight- 2*buttonHeightMargin;
|
||||
}
|
||||
KDCoordinate yOrigin = m_position == Position::Top ? buttonHeightMargin : bounds().height()-rowHeight+buttonHeightMargin;
|
||||
int currentXOrigin = widthMargin;
|
||||
@@ -95,19 +101,21 @@ void ButtonRowController::ContentView::drawRect(KDContext * ctx, KDRect rect) co
|
||||
ctx->fillRect(KDRect(0, k_plainStyleHeight, bounds().width(), 1), Palette::GreyWhite);
|
||||
} else {
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight, bounds().width(), k_plainStyleHeight), KDColorWhite);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight-1, bounds().width(), 1), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight-1, bounds().width(), 1), Palette::GreyWhite);
|
||||
}
|
||||
return;
|
||||
}
|
||||
int buttonHeight = m_size == Size::Small ? k_embossedStyleHeightSmall : k_embossedStyleHeightLarge;
|
||||
int buttonMargin = m_size == Size::Small ? k_embossedStyleHeightMarginSmall : k_embossedStyleHeightMarginLarge;
|
||||
if (m_position == Position::Top) {
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_embossedStyleHeight), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, k_embossedStyleHeight, bounds().width(), 1), Palette::GreyMiddle);
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), buttonHeight), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, buttonHeight, bounds().width(), 1), Palette::GreyMiddle);
|
||||
} else {
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_embossedStyleHeight, bounds().width(), k_embossedStyleHeight), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_embossedStyleHeight-1, bounds().width(), 1), Palette::GreyMiddle);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - buttonHeight, bounds().width(), buttonHeight), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - buttonHeight-1, bounds().width(), 1), Palette::GreyMiddle);
|
||||
}
|
||||
KDCoordinate y0 = m_position == Position::Top ? k_embossedStyleHeightMargin-1 : bounds().height()-k_embossedStyleHeight+k_embossedStyleHeightMargin-1;
|
||||
KDCoordinate y1 = m_position == Position::Top ? k_embossedStyleHeight-k_embossedStyleHeightMargin-2 : bounds().height()-k_embossedStyleHeightMargin;
|
||||
KDCoordinate y0 = m_position == Position::Top ? buttonMargin-1 : bounds().height()-buttonHeight+buttonMargin-1;
|
||||
KDCoordinate y1 = m_position == Position::Top ? buttonHeight-buttonMargin-2 : bounds().height()-buttonMargin;
|
||||
KDCoordinate totalButtonWidth = 0;
|
||||
for (int i = 0; i < numberOfButtons(); i++) {
|
||||
Button * button = buttonAtIndex(i);
|
||||
@@ -147,9 +155,9 @@ bool ButtonRowController::ContentView::setSelectedButton(int selectedButton, App
|
||||
return false;
|
||||
}
|
||||
|
||||
ButtonRowController::ButtonRowController(Responder * parentResponder, ViewController * mainViewController, ButtonRowDelegate * delegate, Position position, Style style) :
|
||||
ButtonRowController::ButtonRowController(Responder * parentResponder, ViewController * mainViewController, ButtonRowDelegate * delegate, Position position, Style style, Size size) :
|
||||
ViewController(parentResponder),
|
||||
m_contentView(mainViewController, delegate, position, style)
|
||||
m_contentView(mainViewController, delegate, position, style, size)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user