Better appearance for dropdown and context menus

This commit is contained in:
Simon Robertshaw 2012-07-25 12:02:14 +01:00
parent 2abb2b2c9f
commit bc2acb9c08
2 changed files with 4 additions and 4 deletions

View File

@ -31,13 +31,13 @@ void ContextMenu::Show(ui::Point position)
buttons.clear(); buttons.clear();
Position = position; Position = position;
Size.Y = items.size()*15; Size.Y = items.size()*16;
Size.X = 100; Size.X = 100;
int currentY = 1; int currentY = 1;
for(int i = 0; i < items.size(); i++) for(int i = 0; i < items.size(); i++)
{ {
Button * tempButton = new Button(Point(1, currentY), Point(Size.X-2, 14), items[i].Text); Button * tempButton = new Button(Point(1, currentY), Point(Size.X-2, 16), items[i].Text);
tempButton->Appearance = Appearance; tempButton->Appearance = Appearance;
tempButton->Enabled = items[i].Enabled; tempButton->Enabled = items[i].Enabled;
tempButton->SetActionCallback(new ItemSelectedAction(this, items[i].ID)); tempButton->SetActionCallback(new ItemSelectedAction(this, items[i].ID));

View File

@ -34,14 +34,14 @@ public:
} }
}; };
DropDownWindow(DropDown * dropDown): 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, 1+dropDown->options.size()*15)), 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()*16)),
dropDown(dropDown), dropDown(dropDown),
appearance(dropDown->Appearance) appearance(dropDown->Appearance)
{ {
int currentY = 1; int currentY = 1;
for(int i = 0; i < dropDown->options.size(); i++) for(int i = 0; i < dropDown->options.size(); i++)
{ {
Button * tempButton = new Button(Point(1, currentY), Point(Size.X-2, 14), dropDown->options[i].first); Button * tempButton = new Button(Point(1, currentY), Point(Size.X-2, 16), dropDown->options[i].first);
tempButton->Appearance = appearance; tempButton->Appearance = appearance;
tempButton->SetActionCallback(new ItemSelectedAction(this, dropDown->options[i].first)); tempButton->SetActionCallback(new ItemSelectedAction(this, dropDown->options[i].first));
AddComponent(tempButton); AddComponent(tempButton);