summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-15 14:01:45 +0000
committerrubidium <rubidium@openttd.org>2009-11-15 14:01:45 +0000
commit54fb9444686533db89883e5720dd0f73223b4da7 (patch)
tree942565dd73eb5440cbbfe510648020b1cfb59d36 /src
parent5fe405bad114ada019616cda4caf0cf9f8886db9 (diff)
downloadopenttd-54fb9444686533db89883e5720dd0f73223b4da7.tar.xz
(svn r18094) -Codechange: make the network content GUI work better with RTL
Diffstat (limited to 'src')
-rw-r--r--src/network/network_content_gui.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 5678aa04d..4e9167190 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -441,12 +441,9 @@ public:
void DrawMatrix(const Rect &r) const
{
- const int CHECKBOX_LEFT = r.left;
- const int TYPE_LEFT = this->GetWidget<NWidgetBase>(NCLWW_TYPE)->pos_x;
- const int NAME_LEFT = this->GetWidget<NWidgetBase>(NCLWW_NAME)->pos_x;
-
- const int TYPE_RIGHT = NAME_LEFT - 1;
- const int NAME_RIGHT = r.right;
+ const NWidgetCore *nwi_checkbox = this->GetWidget<NWidgetCore>(NCLWW_CHECKBOX);
+ const NWidgetCore *nwi_name = this->GetWidget<NWidgetCore>(NCLWW_NAME);
+ const NWidgetCore *nwi_type = this->GetWidget<NWidgetCore>(NCLWW_TYPE);
/* Fill the matrix with the information */
@@ -455,7 +452,7 @@ public:
for (ConstContentIterator iter = this->content.Get(this->vscroll.GetPosition()); iter != this->content.End() && cnt < this->vscroll.GetCapacity(); iter++, cnt++) {
const ContentInfo *ci = *iter;
- if (ci == this->selected) GfxFillRect(CHECKBOX_LEFT + 1, y + 1, NAME_RIGHT - 1, y + this->resize.step_height - 1, 10);
+ if (ci == this->selected) GfxFillRect(r.left + 1, y + 1, r.right - 1, y + this->resize.step_height - 1, 10);
SpriteID sprite;
SpriteID pal = PAL_NONE;
@@ -467,12 +464,12 @@ public:
case ContentInfo::DOES_NOT_EXIST: sprite = SPR_BLOT; pal = PALETTE_TO_RED; break;
default: NOT_REACHED();
}
- DrawSprite(sprite, pal, CHECKBOX_LEFT + (pal == PAL_NONE ? 3 : 4), y + WD_MATRIX_TOP + (pal == PAL_NONE ? 1 : 0));
+ DrawSprite(sprite, pal, nwi_checkbox->pos_x + (pal == PAL_NONE ? 2 : 3), y + WD_MATRIX_TOP + (pal == PAL_NONE ? 1 : 0));
StringID str = STR_CONTENT_TYPE_BASE_GRAPHICS + ci->type - CONTENT_TYPE_BASE_GRAPHICS;
- DrawString(TYPE_LEFT, TYPE_RIGHT, y + WD_MATRIX_TOP, str, TC_BLACK, SA_CENTER);
+ DrawString(nwi_type->pos_x, nwi_type->pos_x + nwi_type->current_x - 1, y + WD_MATRIX_TOP, str, TC_BLACK, SA_CENTER);
- DrawString(NAME_LEFT + 5, NAME_RIGHT, y + WD_MATRIX_TOP, ci->name, TC_BLACK);
+ DrawString(nwi_name->pos_x + WD_FRAMERECT_LEFT, nwi_name->pos_x + nwi_name->current_x - WD_FRAMERECT_RIGHT, y + WD_MATRIX_TOP, ci->name, TC_BLACK);
y += this->resize.step_height;
}
}