diff options
| author | Johannes Schickel | 2012-08-12 14:49:28 +0200 | 
|---|---|---|
| committer | Johannes Schickel | 2012-08-12 14:49:28 +0200 | 
| commit | 4f7c65af0e4c5fb3c6c03b44e3b4405314b6ab24 (patch) | |
| tree | efa33c489905333cd56c8988c3a03e27f47f1fcf /gui/widget.cpp | |
| parent | 61af435d8a870a0630b5dea2ecf69cd58fc95946 (diff) | |
| parent | 71daae7bbc03c1d9327f5353b1450f9d0d9774da (diff) | |
| download | scummvm-rg350-4f7c65af0e4c5fb3c6c03b44e3b4405314b6ab24.tar.gz scummvm-rg350-4f7c65af0e4c5fb3c6c03b44e3b4405314b6ab24.tar.bz2 scummvm-rg350-4f7c65af0e4c5fb3c6c03b44e3b4405314b6ab24.zip | |
Merge pull request #260 from lordhoto/new-chooser.
New save/load chooser
Conflicts:
	gui/saveload.cpp
Diffstat (limited to 'gui/widget.cpp')
| -rw-r--r-- | gui/widget.cpp | 35 | 
1 files changed, 34 insertions, 1 deletions
| diff --git a/gui/widget.cpp b/gui/widget.cpp index 1b68e36ea8..9046bcc9c1 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -296,8 +296,8 @@ ButtonWidget::ButtonWidget(GuiObject *boss, const Common::String &name, const Co  void ButtonWidget::handleMouseUp(int x, int y, int button, int clickCount) {  	if (isEnabled() && x >= 0 && x < _w && y >= 0 && y < _h) { -		sendCommand(_cmd, 0);  		startAnimatePressedState(); +		sendCommand(_cmd, 0);  	}  } @@ -414,6 +414,19 @@ void PicButtonWidget::setGfx(const Graphics::Surface *gfx) {  	_gfx->copyFrom(*gfx);  } +void PicButtonWidget::setGfx(int w, int h, int r, int g, int b) { +	if (w == -1) +		w = _w; +	if (h == -1) +		h = _h; + +	const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat(); + +	_gfx->free(); +	_gfx->create(w, h, requiredFormat); +	_gfx->fillRect(Common::Rect(0, 0, w, h), _gfx->format.RGBToColor(r, g, b)); +} +  void PicButtonWidget::drawWidget() {  	g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags()); @@ -698,6 +711,26 @@ ContainerWidget::ContainerWidget(GuiObject *boss, const Common::String &name) :  	_type = kContainerWidget;  } +ContainerWidget::~ContainerWidget() { +	// We also remove the widget from the boss to avoid segfaults, when the +	// deleted widget is an active widget in the boss. +	for (Widget *w = _firstWidget; w; w = w->next()) { +		_boss->removeWidget(w); +	} +} + +Widget *ContainerWidget::findWidget(int x, int y) { +	return findWidgetInChain(_firstWidget, x, y); +} + +void ContainerWidget::removeWidget(Widget *widget) { +	// We also remove the widget from the boss to avoid a reference to a +	// widget not in the widget chain anymore. +	_boss->removeWidget(widget); + +	Widget::removeWidget(widget); +} +  void ContainerWidget::drawWidget() {  	g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), 0, ThemeEngine::kWidgetBackgroundBorder);  } | 
