console max lines

This commit is contained in:
Eduardo Bart
2011-08-21 18:49:31 -03:00
parent 4ebb201da2
commit 8007e37796
9 changed files with 32 additions and 20 deletions

View File

@@ -17,7 +17,6 @@ UIButton::UIButton(): UIWidget(UITypeButton)
UIButtonPtr UIButton::create()
{
UIButtonPtr button(new UIButton);
button->setStyle("Button");
return button;
}

View File

@@ -288,12 +288,15 @@ void UILineEdit::appendCharacter(char c)
void UILineEdit::removeCharacter(bool right)
{
if(m_cursorPos >= 0 && m_text.length() > 0) {
if(right && (uint)m_cursorPos < m_text.length())
m_text.erase(m_text.begin() + m_cursorPos);
else if((uint)m_cursorPos == m_text.length()) {
if((uint)m_cursorPos >= m_text.length()) {
m_text.erase(m_text.begin() + (--m_cursorPos));
blinkCursor();
} else {
if(right)
m_text.erase(m_text.begin() + m_cursorPos);
else if(m_cursorPos > 0)
m_text.erase(m_text.begin() + --m_cursorPos);
}
blinkCursor();
update();
}
}
@@ -355,7 +358,7 @@ void UILineEdit::onKeyPress(UIKeyEvent& event)
{
if(event.keyCode() == KC_DELETE) // erase right character
removeCharacter(true);
else if(event.keyCode() == KC_BACK) // erase left character
else if(event.keyCode() == KC_BACK) // erase left character {
removeCharacter(false);
else if(event.keyCode() == KC_RIGHT) // move cursor right
moveCursor(true);

View File

@@ -287,8 +287,8 @@ bool UIWidget::hasFocus()
if(parent->hasFocus() && parent->getFocusedChild() == shared_from_this())
return true;
}
// root widget always has focus
else if(asUIWidget() == g_ui.getRootWidget())
// root parent always has focus
else if(asUIWidget() == getRootParent())
return true;
return false;
}
@@ -350,7 +350,7 @@ UIWidgetPtr UIWidget::getChildById(const std::string& childId)
else if(childId == "parent")
return getParent();
else if(childId == "root")
return g_ui.getRootWidget();
return getRootParent();
else if(childId == "prev") {
if(UIWidgetPtr parent = getParent())
return parent->getChildBefore(asUIWidget());
@@ -468,7 +468,7 @@ void UIWidget::addChild(const UIWidgetPtr& childToAdd)
updateChildrenLayout();
// always focus new children
if(childToAdd->isFocusable())
if(childToAdd->isFocusable() && childToAdd->isExplicitlyVisible() && childToAdd->isExplicitlyEnabled())
focusChild(childToAdd, ActiveFocusReason);
}

View File

@@ -11,7 +11,6 @@ UIWindow::UIWindow(): UIWidget(UITypeWindow)
UIWindowPtr UIWindow::create()
{
UIWindowPtr window(new UIWindow);
window->setStyle("Window");
return window;
}