diff options
| author | Matthew Hoops | 2012-08-26 15:49:45 -0400 | 
|---|---|---|
| committer | Matthew Hoops | 2012-08-26 16:12:25 -0400 | 
| commit | bb1e60e8b2f3bba06ae3b089097f94ea82a70c8a (patch) | |
| tree | a434233367725fbb6dc7072776c312f52254d57f /gui/widget.cpp | |
| parent | 7a49b3669a0e18210a2f5409cb35da735f549b11 (diff) | |
| parent | 857b92f8ffececa9c1f990d21a6a8d1630199a62 (diff) | |
| download | scummvm-rg350-bb1e60e8b2f3bba06ae3b089097f94ea82a70c8a.tar.gz scummvm-rg350-bb1e60e8b2f3bba06ae3b089097f94ea82a70c8a.tar.bz2 scummvm-rg350-bb1e60e8b2f3bba06ae3b089097f94ea82a70c8a.zip | |
Merge remote branch 'upstream/master' into pegasus
Conflicts:
	AUTHORS
	devtools/credits.pl
	gui/credits.h
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);  } | 
