From b4607a6c80a5ab7b09a79baa7b9f9d9c7aeab6ef Mon Sep 17 00:00:00 2001 From: Eugenio Favalli Date: Sun, 16 Jan 2005 16:39:46 +0000 Subject: Checkbox update --- src/gui/checkbox.cpp | 24 ++++++++++++++++-------- src/gui/checkbox.h | 6 ++++++ 2 files changed, 22 insertions(+), 8 deletions(-) (limited to 'src') 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 -- cgit v1.2.3-70-g09d2