diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-14 19:47:14 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-05-14 19:47:14 (GMT) |
| commit | f39d2361e7e7ae13f84ab61920930847742b413a (patch) | |
| tree | 9dcdaadde02620ce00aaf460a9c7cd5e2c954770 /src/interface/DropDown.cpp | |
| parent | 4bb90d0d79d983c2f6d16af4575661b845a3d72f (diff) | |
| download | powder-f39d2361e7e7ae13f84ab61920930847742b413a.zip powder-f39d2361e7e7ae13f84ab61920930847742b413a.tar.gz | |
Improve appearance of some dialogues, style defaults
Diffstat (limited to 'src/interface/DropDown.cpp')
| -rw-r--r-- | src/interface/DropDown.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/interface/DropDown.cpp b/src/interface/DropDown.cpp index 8b9c976..5ad255a 100644 --- a/src/interface/DropDown.cpp +++ b/src/interface/DropDown.cpp @@ -6,6 +6,7 @@ */ #include <iostream> +#include "Style.h" #include "Button.h" #include "DropDown.h" @@ -35,29 +36,31 @@ public: } }; DropDownWindow(DropDown * dropDown): - Window(ui::Point(dropDown->Position.X+dropDown->GetParentWindow()->Position.X-5, dropDown->Position.Y+dropDown->GetParentWindow()->Position.Y-3), ui::Point(dropDown->Size.X+10, dropDown->options.size()*13)), + Window(ui::Point(dropDown->Position.X+dropDown->GetParentWindow()->Position.X-5, dropDown->Position.Y+dropDown->GetParentWindow()->Position.Y-3), ui::Point(dropDown->Size.X+10, 1+dropDown->options.size()*15)), dropDown(dropDown), - background(background), + background(dropDown->background), activeBackground(dropDown->activeBackground), border(dropDown->border), activeBorder(dropDown->activeBorder), text(dropDown->text), activeText(dropDown->activeText) { - int currentY = 0; + int currentY = 1; for(int i = 0; i < dropDown->options.size(); i++) { - Button * tempButton = new Button(Point(0, currentY), Point(Size.X, 14), dropDown->options[i].first); + Button * tempButton = new Button(Point(1, currentY), Point(Size.X-2, 14), dropDown->options[i].first); + tempButton->SetTextColour(dropDown->text); + tempButton->SetBorderColour(dropDown->background); tempButton->SetActionCallback(new ItemSelectedAction(this, dropDown->options[i].first)); AddComponent(tempButton); - currentY += 13; + currentY += 15; } } virtual void OnDraw() { Graphics * g = ui::Engine::Ref().g; - g->fillrect(Position.X, Position.Y, Size.X, Size.Y, background.Red, background.Green, background.Blue, 255); - g->drawrect(Position.X, Position.Y, Size.X, Size.Y, border.Red, border.Green, border.Blue, 255); + g->fillrect(Position.X, Position.Y, Size.X, Size.Y, 100, 100, 100, 255); + g->drawrect(Position.X, Position.Y, Size.X, Size.Y, border.Red, border.Green, border.Blue, border.Alpha); } void setOption(std::string option) { @@ -85,8 +88,12 @@ DropDown::DropDown(Point position, Point size): textHAlign(AlignLeft), callback(NULL) { - background = activeBackground = Colour(0, 0, 0); - activeText = text = activeBackground = border = activeBorder = Colour(255, 255, 255); + activeText = text = Colour(255, 255, 255); + + border = style::Colour::InactiveBorder; + activeBorder = style::Colour::ActiveBorder; + background = style::Colour::InactiveBackground; + activeBackground = style::Colour::ActiveBackground; } void DropDown::OnMouseClick(int x, int y, unsigned int button) |
