diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/checkbox.cpp | 24 | ||||
-rw-r--r-- | src/gui/checkbox.h | 6 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp index aa6a665a..ed0bb841 100644 --- a/src/gui/checkbox.cpp +++ b/src/gui/checkbox.cpp @@ -26,28 +26,36 @@ CheckBox::CheckBox(const std::string& caption, bool marked): gcn::CheckBox(caption, marked) { + ResourceManager *resman = ResourceManager::getInstance(); + Image *checkBox = resman->getImage("core/graphics/gui/checkbox.bmp"); + checkBoxNormal = checkBox->getSubImage(0, 0, 9, 10); + checkBoxChecked = checkBox->getSubImage(9, 0, 9, 10); + checkBoxDisabled = checkBox->getSubImage(18, 0, 9, 10); + checkBoxDisabledChecked = checkBox->getSubImage(27, 0, 9, 10); + } void CheckBox::drawBox(gcn::Graphics* graphics) { - BITMAP *box = NULL; + Image *box = NULL; int x, y; getAbsolutePosition(x, y); if (mMarked) { if (false /*disabled*/) { - box = gui_skin.checkbox.disabled_checked; + box = checkBoxDisabledChecked; } else { - box = gui_skin.checkbox.checked; + box = checkBoxChecked; } } else if (false /*disabled*/) { - box = gui_skin.checkbox.disabled; + box = checkBoxDisabled; } else { - box = gui_skin.checkbox.normal; + box = checkBoxNormal; } x += 2; - y += 2; - - masked_blit(box, buffer, 0, 0, x, y, box->w, box->h); + y += 2; + if(box != NULL) { + box->draw(buffer, x, y); + } } diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h index 5e410a7e..3a678c5e 100644 --- a/src/gui/checkbox.h +++ b/src/gui/checkbox.h @@ -42,6 +42,12 @@ class CheckBox : public gcn::CheckBox { * Draws the check box, not the caption. */ void drawBox(gcn::Graphics* graphics); + + private: + Image *checkBoxNormal; + Image *checkBoxChecked; + Image *checkBoxDisabled; + Image *checkBoxDisabledChecked; }; #endif |