mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
fix merge
This commit is contained in:
@@ -42,7 +42,8 @@ void LuaInterface::registerFunctions()
|
||||
g_lua.bindClassMemberFunction<UIWidget>("fill", &UIWidget::fill);
|
||||
g_lua.bindClassMemberFunction<UIWidget>("centerIn", &UIWidget::centerIn);
|
||||
g_lua.bindClassMemberFunction<UIWidget>("addAnchor", &UIWidget::addAnchor);
|
||||
g_lua.bindClassMemberFunction<UIWidget>("getChild", &UIWidget::getChildById);
|
||||
g_lua.bindClassMemberFunction<UIWidget>("getChildById", &UIWidget::getChildById);
|
||||
g_lua.bindClassMemberFunction<UIWidget>("getChildByIndex", &UIWidget::getChildByIndex);
|
||||
g_lua.bindClassMemberFunction<UIWidget>("insertChild", &UIWidget::insertChild);
|
||||
g_lua.bindClassMemberFunction<UIWidget>("removeChild", &UIWidget::removeChild);
|
||||
g_lua.bindClassMemberFunction<UIWidget>("addChild", &UIWidget::addChild);
|
||||
|
@@ -16,8 +16,10 @@ void Protocol::connect(const std::string& host, uint16 port)
|
||||
|
||||
void Protocol::disconnect()
|
||||
{
|
||||
m_connection->close();
|
||||
m_connection.reset();
|
||||
if(m_connection) {
|
||||
m_connection->close();
|
||||
m_connection.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void Protocol::send(OutputMessage& outputMessage)
|
||||
|
@@ -17,7 +17,6 @@ UIButton::UIButton(): UIWidget(UITypeButton)
|
||||
UIButtonPtr UIButton::create()
|
||||
{
|
||||
UIButtonPtr button(new UIButton);
|
||||
button->setStyle("Button");
|
||||
return button;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,6 @@ UIWindow::UIWindow(): UIWidget(UITypeWindow)
|
||||
UIWindowPtr UIWindow::create()
|
||||
{
|
||||
UIWindowPtr window(new UIWindow);
|
||||
window->setStyle("Window");
|
||||
return window;
|
||||
}
|
||||
|
||||
|
@@ -81,7 +81,7 @@ void Creature::drawInformation(int x, int y, bool useGray)
|
||||
|
||||
// name
|
||||
FontPtr font = g_fonts.getFont("tibia-12px-rounded");
|
||||
font->renderText(m_name, Rect(x-50, y-15, 100, 15), AlignTopCenter, fillColor);
|
||||
font->renderText(m_name, Rect(x-100, y-15, 200, 15), AlignTopCenter, fillColor);
|
||||
}
|
||||
|
||||
const ThingAttributes& Creature::getAttributes()
|
||||
|
Reference in New Issue
Block a user