diff options
author | erihel <erihel@gmail.com> | 2012-08-18 21:04:51 +0200 |
---|---|---|
committer | erihel <erihel@gmail.com> | 2012-08-18 21:04:51 +0200 |
commit | 8d4a3ed57915af2acf8b3dcd9a8aec5a75806ca6 (patch) | |
tree | ffee78fc822604f9c5c3ab468c8da04862f31283 /src/ui/list.cpp | |
parent | 48ad79a03c12b923dfdb3795a2138445859cf779 (diff) | |
download | colobot-8d4a3ed57915af2acf8b3dcd9a8aec5a75806ca6.tar.gz colobot-8d4a3ed57915af2acf8b3dcd9a8aec5a75806ca6.tar.bz2 colobot-8d4a3ed57915af2acf8b3dcd9a8aec5a75806ca6.zip |
* wrong enum used for text alignment
* wrong event function used
Diffstat (limited to 'src/ui/list.cpp')
-rw-r--r-- | src/ui/list.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/ui/list.cpp b/src/ui/list.cpp index 9f1d579..73a48e3 100644 --- a/src/ui/list.cpp +++ b/src/ui/list.cpp @@ -42,7 +42,7 @@ CList::CList() : CControl() for (int i = 0; i < 10; i++) { m_tabs[i] = 0.0f; - m_justifs[i] = Gfx::TEXT_ALIGN_CENTER; + m_justifs[i] = Gfx::TEXT_ALIGN_RIGHT; } m_totalLine = 0; @@ -72,14 +72,10 @@ CList::~CList() bool CList::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand) { - Event event; m_expand = expand; - if (eventMsg == EVENT_NULL) { - m_event->GetEvent(event); - eventMsg = event.type; - } - + if (eventMsg == EVENT_NULL) + eventMsg = GetUniqueEventType(); CControl::Create(pos, dim, icon, eventMsg); @@ -131,7 +127,7 @@ bool CList::MoveAdjust() for (int i = 0; i < m_displayLine; i++) { m_button[i] = new CButton(); m_button[i]->Create(ppos, ddim, -1, EVENT_NULL); - m_button[i]->SetTextAlign(Gfx::TEXT_ALIGN_CENTER); + m_button[i]->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT); m_button[i]->SetState(STATE_SIMPLY); m_button[i]->SetFontType(m_fontType); m_button[i]->SetFontSize(m_fontSize); @@ -417,7 +413,7 @@ void CList::Draw() ppos.y = pos.y + dim.y * 0.5f; ppos.y -= m_engine->GetText()->GetHeight(m_fontType, m_fontSize) / 2.0f; ddim.x = dim.x-dim.y; - DrawCase(m_text[i + m_firstLine], ppos, ddim.x, Gfx::TEXT_ALIGN_CENTER); + DrawCase(m_text[i + m_firstLine], ppos, ddim.x, Gfx::TEXT_ALIGN_RIGHT); } else { ppos.x = pos.x + dim.y * 0.5f; ppos.y = pos.y + dim.y * 0.5f; @@ -505,9 +501,9 @@ void CList::Draw() void CList::DrawCase(char *text, Math::Point pos, float width, Gfx::TextAlign justif) { - if (justif == Gfx::TEXT_ALIGN_LEFT) + if (justif == Gfx::TEXT_ALIGN_CENTER) pos.x += width / 2.0f; - else + else if (justif == Gfx::TEXT_ALIGN_LEFT) pos.x += width; m_engine->GetText()->DrawText(std::string(text), m_fontType, m_fontSize, pos, width, justif, 0); } |