2
Copyright (C) 2006 Parallel Realities
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
as published by the Free Software Foundation; either version 2
7
of the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
See the GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
#include "../headers.h"
23
BaseWidget::BaseWidget()
25
x = y = width = height = 0;
39
BaseWidget::~BaseWidget()
43
int BaseWidget::getWidgetType()
48
char *BaseWidget::getName()
50
return name.getText();
53
char *BaseWidget::getGroupName()
55
return groupName.getText();
58
bool BaseWidget::isEnabled()
63
bool BaseWidget::isVisible()
68
void BaseWidget::setVisible(bool visible)
70
this->visible = visible;
73
void BaseWidget::setBaseValues(Properties *properties)
75
name = properties->getString("name", "NULL");
76
groupName = properties->getString("groupName", "NULL");
78
enabled = properties->getInt("enabled", 0);
79
visible = properties->getInt("visible", 0);
80
gridX = properties->getInt("x", 0);
81
gridY = properties->getInt("y", 0);
83
horizontalAlignment = properties->getInt("horizontalAlignment", 0);
84
verticleAlignment = properties->getInt("verticleAlignment", 0);
86
fontSize = properties->getInt("fontSize", 0);
88
grid = UIManager::getInstance()->getGrid(properties->getString("grid", "unknown"));
93
void BaseWidget::updatePosition()
95
x = grid->getCellX(gridX);
96
y = grid->getCellY(gridY);
98
if (widgetType != LISTVIEW)
100
y += (grid->getCellHeight() - height) / 2;
104
// All abstract methods follow
106
void BaseWidget::use(int x, int y){}
107
void BaseWidget::setEnabled(bool enabled){}
108
void BaseWidget::mousePressed(SDL_MouseButtonEvent mouse){}
109
void BaseWidget::mouseReleased(SDL_MouseButtonEvent mouse){}
110
void BaseWidget::mouseMoved(int x, int y){}
111
void BaseWidget::keyPressed(int key, bool shiftHeld){}
112
void BaseWidget::joystickButtonPressed(int key){}