summaryrefslogtreecommitdiff
path: root/src/interface/Checkbox.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2013-03-24 12:24:17 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2013-03-24 12:24:17 (GMT)
commit9b5b85f9b01cbda7ef9a7ec2a15b2a35630a5b9d (patch)
treeac7d040253b459ce102e476cb19ab59e3cfa90d7 /src/interface/Checkbox.cpp
parent6bf98ccdca39936a3c51367862eed7c49f8786ec (diff)
parentbdc69f31c0be94191015838886bdcc2bc67f1acb (diff)
downloadpowder-9b5b85f9b01cbda7ef9a7ec2a15b2a35630a5b9d.zip
powder-9b5b85f9b01cbda7ef9a7ec2a15b2a35630a5b9d.tar.gz
Merge branch 'reorganisation' of github.com:FacialTurd/The-Powder-Toy
Diffstat (limited to 'src/interface/Checkbox.cpp')
-rw-r--r--src/interface/Checkbox.cpp104
1 files changed, 0 insertions, 104 deletions
diff --git a/src/interface/Checkbox.cpp b/src/interface/Checkbox.cpp
deleted file mode 100644
index 7caf18b..0000000
--- a/src/interface/Checkbox.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-#include "Checkbox.h"
-
-using namespace ui;
-
-Checkbox::Checkbox(ui::Point position, ui::Point size, std::string text, std::string toolTip):
- Component(position, size),
- text(text),
- toolTip(toolTip),
- isMouseOver(false),
- checked(false),
- actionCallback(NULL)
-{
-
-}
-
-void Checkbox::SetText(std::string text)
-{
- this->text = text;
-}
-
-std::string Checkbox::GetText()
-{
- return text;
-}
-
-void Checkbox::SetIcon(Icon icon)
-{
- Appearance.icon = icon;
- iconPosition.X = 16;
- iconPosition.Y = 3;
-}
-
-void Checkbox::OnMouseClick(int x, int y, unsigned int button)
-{
- if(checked)
- {
- checked = false;
- }
- else
- {
- checked = true;
- }
- if(actionCallback)
- actionCallback->ActionCallback(this);
-}
-
-void Checkbox::OnMouseUp(int x, int y, unsigned int button)
-{
-
-}
-
-
-void Checkbox::OnMouseEnter(int x, int y)
-{
- isMouseOver = true;
- if(toolTip.length()>0 && GetParentWindow())
- {
- GetParentWindow()->ToolTip(this, ui::Point(x, y), toolTip);
- }
-}
-
-void Checkbox::OnMouseLeave(int x, int y)
-{
- isMouseOver = false;
-}
-
-void Checkbox::Draw(const Point& screenPos)
-{
- Graphics * g = Engine::Ref().g;
- if(checked)
- {
- g->fillrect(screenPos.X+5, screenPos.Y+5, 6, 6, 255, 255, 255, 255);
- }
- if(isMouseOver)
- {
- g->drawrect(screenPos.X+2, screenPos.Y+2, 12, 12, 255, 255, 255, 255);
- g->fillrect(screenPos.X+5, screenPos.Y+5, 6, 6, 255, 255, 255, 170);
- if (!Appearance.icon)
- g->drawtext(screenPos.X+18, screenPos.Y+4, text, 255, 255, 255, 255);
- else
- g->draw_icon(screenPos.X+iconPosition.X, screenPos.Y+iconPosition.Y, Appearance.icon, 255);
- }
- else
- {
- g->drawrect(screenPos.X+2, screenPos.Y+2, 12, 12, 255, 255, 255, 200);
- if (!Appearance.icon)
- g->drawtext(screenPos.X+18, screenPos.Y+4, text, 255, 255, 255, 200);
- else
- g->draw_icon(screenPos.X+iconPosition.X, screenPos.Y+iconPosition.Y, Appearance.icon, 200);
- }
-}
-
-void Checkbox::SetActionCallback(CheckboxAction * action)
-{
- if(actionCallback)
- delete actionCallback;
- actionCallback = action;
-}
-
-Checkbox::~Checkbox() {
- if(actionCallback)
- delete actionCallback;
-}
-