aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorEugene Sandulenko2006-05-18 20:53:28 +0000
committerEugene Sandulenko2006-05-18 20:53:28 +0000
commit4ead8dff26c85f76ffcb46e35f8ed8684664713a (patch)
tree4ff41850543e737556a3ec7c53d9f3a881643152 /gui
parent63d7895500c22869c6ea6536775bc71c05587560 (diff)
downloadscummvm-rg350-4ead8dff26c85f76ffcb46e35f8ed8684664713a.tar.gz
scummvm-rg350-4ead8dff26c85f76ffcb46e35f8ed8684664713a.tar.bz2
scummvm-rg350-4ead8dff26c85f76ffcb46e35f8ed8684664713a.zip
- Fix spelling in theme config
- Introduce embossing shadow - Less round corners in popup widget - Custom border in editable text widget - Matched color in popup widget and editable text widget with mock-ups - Less round corners in editable text widget - Text padding in editable text widget svn-id: r22525
Diffstat (limited to 'gui')
-rw-r--r--gui/EditTextWidget.cpp18
-rw-r--r--gui/EditTextWidget.h5
-rw-r--r--gui/ThemeNew.cpp92
-rw-r--r--gui/theme.h18
-rw-r--r--gui/themes/modern.ini42
5 files changed, 130 insertions, 45 deletions
diff --git a/gui/EditTextWidget.cpp b/gui/EditTextWidget.cpp
index fa5bdfdca8..5499d655fe 100644
--- a/gui/EditTextWidget.cpp
+++ b/gui/EditTextWidget.cpp
@@ -22,6 +22,7 @@
#include "common/stdafx.h"
#include "gui/EditTextWidget.h"
#include "gui/dialog.h"
+#include "gui/eval.h"
#include "gui/newgui.h"
namespace GUI {
@@ -32,14 +33,19 @@ EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, cons
_type = kEditTextWidget;
setEditString(text);
+
+ handleScreenChanged();
}
EditTextWidget::EditTextWidget(GuiObject *boss, String name, const String &text)
: EditableWidget(boss, name) {
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
_type = kEditTextWidget;
+ _hints |= THEME_HINT_USE_SHADOW;
setEditString(text);
+
+ handleScreenChanged();
}
void EditTextWidget::setEditString(const String &str) {
@@ -47,6 +53,12 @@ void EditTextWidget::setEditString(const String &str) {
_backupString = str;
}
+void EditTextWidget::handleScreenChanged() {
+ _leftPadding = g_gui.evaluator()->getVar("EditTextWidget.leftPadding", 0);
+ _rightPadding = g_gui.evaluator()->getVar("EditTextWidget.rightPadding", 0);
+}
+
+
void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount) {
// First remove caret
if (_caretVisible)
@@ -68,15 +80,15 @@ void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount) {
void EditTextWidget::drawWidget(bool hilite) {
- g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x+_w, _y+_h), _hints, Theme::kWidgetBackgroundBorderSmall);
+ g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x+_w, _y+_h), _hints, Theme::kWidgetBackgroundEditText);
// Draw the text
adjustOffset();
- g_gui.theme()->drawText(Common::Rect(_x+2,_y+2, _x+getEditRect().width()-2, _y+_h-2), _editString, Theme::kStateEnabled, Theme::kTextAlignLeft, false, -_editScrollOffset, false, Theme::kFontStyleNormal);
+ g_gui.theme()->drawText(Common::Rect(_x+2 + _leftPadding,_y+2, _x+getEditRect().width()-2, _y+_h-2), _editString, Theme::kStateEnabled, Theme::kTextAlignLeft, false, -_editScrollOffset, false, Theme::kFontStyleNormal);
}
Common::Rect EditTextWidget::getEditRect() const {
- Common::Rect r(2, 1, _w - 2, _h);
+ Common::Rect r(2 + _leftPadding, 1, _w - 2 - _leftPadding, _h);
return r;
}
diff --git a/gui/EditTextWidget.h b/gui/EditTextWidget.h
index 8dc0357282..986e699cbb 100644
--- a/gui/EditTextWidget.h
+++ b/gui/EditTextWidget.h
@@ -34,6 +34,9 @@ protected:
String _backupString;
+ int _leftPadding;
+ int _rightPadding;
+
public:
EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, WidgetSize ws = kNormalWidgetSize);
EditTextWidget(GuiObject *boss, String name, const String &text);
@@ -44,6 +47,8 @@ public:
virtual bool wantsFocus() { return true; }
+ virtual void handleScreenChanged();
+
protected:
void drawWidget(bool hilite);
void receivedFocusWidget();
diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp
index 2a1718893e..f18030e8a8 100644
--- a/gui/ThemeNew.cpp
+++ b/gui/ThemeNew.cpp
@@ -37,8 +37,9 @@
#define kShadowTr2 32
#define kShadowTr3 64
#define kShadowTr4 128
+#define kShadowTr5 192
-#define THEME_VERSION 11
+#define THEME_VERSION 12
using Graphics::Surface;
@@ -218,6 +219,11 @@ _lastUsedBitMask(0), _forceRedraw(false), _fonts(), _imageHandles(0), _images(0)
_configFile.getKey("popupwidget_left", "pixmaps", imageHandlesTable[kPopUpWidgetBkgdLeft]);
_configFile.getKey("popupwidget_bkgd", "pixmaps", imageHandlesTable[kPopUpWidgetBkgd]);
+ _configFile.getKey("edittext_bkgd_corner", "pixmaps", imageHandlesTable[kEditTextBkgdCorner]);
+ _configFile.getKey("edittext_bkgd_top", "pixmaps", imageHandlesTable[kEditTextBkgdTop]);
+ _configFile.getKey("edittext_bkgd_left", "pixmaps", imageHandlesTable[kEditTextBkgdLeft]);
+ _configFile.getKey("edittext_bkgd", "pixmaps", imageHandlesTable[kEditTextBkgd]);
+
_configFile.getKey("cursor_image", "pixmaps", imageHandlesTable[kGUICursor]);
// load the gradient factors from the config file
@@ -239,6 +245,8 @@ _lastUsedBitMask(0), _forceRedraw(false), _fonts(), _imageHandles(0), _images(0)
getFactorFromConfig(_configFile, "scrollbar_background", _gradientFactors[kScrollbarBkgdFactor]);
getFactorFromConfig(_configFile, "popupwidget", _gradientFactors[kPopUpWidgetFactor]);
+
+ getFactorFromConfig(_configFile, "edittext", _gradientFactors[kEditTextFactor]);
// load values with default values from the config file
getExtraValueFromConfig(_configFile, "shadow_left_width", _shadowLeftWidth, 2);
@@ -508,33 +516,56 @@ void ThemeNew::drawWidgetBackground(const Common::Rect &r, uint16 hints, kWidget
restoreBackground((hints & THEME_HINT_USE_SHADOW) ? r2 : r);
return;
}
-
- if (background == kWidgetBackgroundBorderSmall) {
- if ((hints & THEME_HINT_USE_SHADOW)) {
- r2 = shadowRect(r, kShadowSmall);
- restoreBackground(r2);
- // shadow
- drawShadow(r, surface(kWidgetSmallBkgdCorner), surface(kWidgetSmallBkgdTop), surface(kWidgetSmallBkgdLeft),
- surface(kWidgetSmallBkgd), kShadowSmall);
- }
- drawRectMasked(r, surface(kWidgetSmallBkgdCorner), surface(kWidgetSmallBkgdTop), surface(kWidgetSmallBkgdLeft), surface(kWidgetSmallBkgd),
- (state == kStateDisabled) ? -30 : 256, _colors[kWidgetBackgroundSmallStart], _colors[kWidgetBackgroundSmallEnd],
- _gradientFactors[kWidgetSmallFactor]);
- } else {
- if ((hints & THEME_HINT_USE_SHADOW)) {
- r2 = shadowRect(r, kShadowFull);
- restoreBackground(r2);
- // shadow
- drawShadow(r, surface(kWidgetBkgdCorner), surface(kWidgetBkgdTop), surface(kWidgetBkgdLeft), surface(kWidgetBkgd),
- kShadowFull);
- }
+ kImageHandles corner, top, left, bkgd;
+ kShadowStyles shadow;
+ kColorHandles start, end;
+ kGradientFactors factor;
+
+ switch (background) {
+ case kWidgetBackgroundBorderSmall:
+ corner = kWidgetSmallBkgdCorner;
+ top = kWidgetSmallBkgdTop;
+ left = kWidgetSmallBkgdLeft;
+ bkgd = kWidgetSmallBkgd;
+ shadow = kShadowSmall;
+ start = kWidgetBackgroundSmallStart;
+ end = kWidgetBackgroundSmallEnd;
+ factor = kWidgetSmallFactor;
+ break;
+ case kWidgetBackgroundEditText:
+ corner = kEditTextBkgdCorner;
+ top = kEditTextBkgdTop;
+ left = kEditTextBkgdLeft;
+ bkgd = kEditTextBkgd;
+ shadow = kShadowEmboss;
+ start = kEditTextBackgroundStart;
+ end = kEditTextBackgroundEnd;
+ factor = kEditTextFactor;
+ break;
+ default:
+ corner = kWidgetBkgdCorner;
+ top = kWidgetBkgdTop;
+ left = kWidgetBkgdLeft;
+ bkgd = kWidgetBkgd;
+ shadow = kShadowFull;
+ start = kWidgetBackgroundStart;
+ end = kWidgetBackgroundEnd;
+ factor = kWidgetFactor;
+ break;
+ }
- drawRectMasked(r, surface(kWidgetBkgdCorner), surface(kWidgetBkgdTop), surface(kWidgetBkgdLeft), surface(kWidgetBkgd),
- (state == kStateDisabled) ? -30 : 256, _colors[kWidgetBackgroundStart], _colors[kWidgetBackgroundEnd],
- _gradientFactors[kWidgetFactor]);
+ if ((hints & THEME_HINT_USE_SHADOW)) {
+ r2 = shadowRect(r, shadow);
+ restoreBackground(r2);
+ // shadow
+ drawShadow(r, surface(corner), surface(top), surface(left), surface(bkgd), shadow);
}
+ drawRectMasked(r, surface(corner), surface(top), surface(left), surface(bkgd),
+ (state == kStateDisabled) ? -30 : 256, _colors[start], _colors[end],
+ _gradientFactors[factor]);
+
addDirtyRect((hints & THEME_HINT_USE_SHADOW) ? r2 : r, (hints & THEME_HINT_SAVE_BACKGROUND) != 0);
}
@@ -1047,6 +1078,14 @@ void ThemeNew::drawShadow(const Common::Rect &r, const Graphics::Surface *corner
drawShadowRect(r4, r, corner, top, left, fill, kShadowTr3, skipLastRow);
};
+ case kShadowEmboss: {
+ Common::Rect r2(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right, r.bottom);
+ Common::Rect r4(r.left - _shadowLeftWidth/2+1, r.top - _shadowTopHeight/2+1, r.right + _shadowRightWidth/2, r.bottom + _shadowBottomHeight/2);
+
+ drawShadowRect(r2, r, corner, top, left, fill, kShadowTr5, skipLastRow);
+ drawShadowRect(r4, r, corner, top, left, fill, kShadowTr1, skipLastRow);
+ };
+
default:
break;
}
@@ -1307,9 +1346,12 @@ void ThemeNew::setupColors() {
getColorFromConfig(_configFile, "caret_color", _colors[kCaretColor]);
getColorFromConfig(_configFile, "popupwidget_start", _colors[kPopUpWidgetStart]);
- getColorFromConfig(_configFile, "pupupwidget_end", _colors[kPopUpWidgetEnd]);
+ getColorFromConfig(_configFile, "popupwidget_end", _colors[kPopUpWidgetEnd]);
getColorFromConfig(_configFile, "popupwidget_highlight_start", _colors[kPopUpWidgetHighlightStart]);
getColorFromConfig(_configFile, "popupwidget_highlight_end", _colors[kPopUpWidgetHighlightEnd]);
+
+ getColorFromConfig(_configFile, "edittext_background_start", _colors[kEditTextBackgroundStart]);
+ getColorFromConfig(_configFile, "edittext_background_end", _colors[kEditTextBackgroundEnd]);
}
#define FONT_NAME_NORMAL "newgui_normal"
diff --git a/gui/theme.h b/gui/theme.h
index 557010f1a4..314063cbd6 100644
--- a/gui/theme.h
+++ b/gui/theme.h
@@ -77,7 +77,8 @@ public:
kWidgetBackgroundNo,
kWidgetBackgroundPlain,
kWidgetBackgroundBorder,
- kWidgetBackgroundBorderSmall
+ kWidgetBackgroundBorderSmall,
+ kWidgetBackgroundEditText
};
enum kState {
@@ -337,7 +338,8 @@ private:
kShadowFull = 0,
kShadowSmall = 1,
kShadowButton = 2,
- kShadowSlider = 3
+ kShadowSlider = 3,
+ kShadowEmboss = 4
};
Common::Rect shadowRect(const Common::Rect &r, uint32 shadowStyle);
@@ -436,7 +438,12 @@ public:
kPopUpWidgetBkgdLeft = 42,
kPopUpWidgetBkgd = 43,
- kGUICursor = 44,
+ kEditTextBkgdCorner = 44,
+ kEditTextBkgdTop = 45,
+ kEditTextBkgdLeft = 46,
+ kEditTextBkgd = 47,
+
+ kGUICursor = 48,
kImageHandlesMax
};
@@ -524,6 +531,9 @@ private:
kPopUpWidgetHighlightStart = 42,
kPopUpWidgetHighlightEnd = 43,
+ kEditTextBackgroundStart = 44,
+ kEditTextBackgroundEnd = 45,
+
kColorHandlesMax
};
@@ -549,6 +559,8 @@ private:
kPopUpWidgetFactor = 10,
+ kEditTextFactor = 11,
+
kMaxGradientFactors
};
diff --git a/gui/themes/modern.ini b/gui/themes/modern.ini
index 4a837ded16..d0486e3c3f 100644
--- a/gui/themes/modern.ini
+++ b/gui/themes/modern.ini
@@ -1,7 +1,7 @@
# $URL$
# $Id$
[theme]
-version=11
+version=12
[pixmaps]
dialog_corner=dialog_bkgd_corner.bmp
@@ -54,10 +54,15 @@ button_top=button_bkgd_top.bmp
button_left=button_bkgd_left.bmp
button_bkgd=button_bkgd.bmp
-popupwidget_corner=widget_small_bkgd_corner.bmp
-popupwidget_top=widget_small_bkgd_top.bmp
-popupwidget_left=widget_small_bkgd_left.bmp
-popupwidget_bkgd=widget_small_bkgd.bmp
+popupwidget_corner=button_bkgd_corner.bmp
+popupwidget_top=button_bkgd_top.bmp
+popupwidget_left=button_bkgd_left.bmp
+popupwidget_bkgd=button_bkgd.bmp
+
+edittext_bkgd_corner=button_bkgd_corner.bmp
+edittext_bkgd_top=button_bkgd_top.bmp
+edittext_bkgd_left=button_bkgd_left.bmp
+edittext_bkgd=button_bkgd.bmp
theme_logo=logo.bmp
@@ -113,11 +118,15 @@ scrollbar_button_highlight_end=200 70 50
scrollbar_slider_highlight_start=255 210 200
scrollbar_slider_highlight_end=200 70 50
-popupwidget_start=246 224 139
-pupupwidget_end=251 241 206
+popupwidget_start=251 241 206
+popupwidget_end=251 241 206
popupwidget_highlight_start=246 224 139
popupwidget_highlight_end=251 241 206
+edittext_background_start=247 228 166
+edittext_background_end=247 228 166
+
+
caret_color=0 0 0
[gradients]
@@ -138,7 +147,9 @@ tab=2
scrollbar=1
scrollbar_background=1
-popupwidget=3
+popupwidget=1
+
+edittext=1
[extra]
shadow_left_width=2
@@ -161,6 +172,7 @@ def_sliderWidth=kBigSliderWidth
def_sliderHeight=kBigSliderHeight
def_kLineHeight=16
def_kFontHeight=14
+def_kPopUpHeight=(kLineHeight + 3)
def_insetX=23
def_insetY=94
def_insetW=(w - buttonWidth - 17 * 2 - insetX)
@@ -186,6 +198,8 @@ ListWidget.hlLeftPadding=0
ListWidget.hlRightPadding=0
PopUpWidget.leftPadding=7
PopUpWidget.rightPadding=7
+EditTextWidget.leftPadding=7
+EditTextWidget.rightPadding=7
###### chooser
opHeight=insetH
@@ -268,13 +282,13 @@ gameoptions_tabwidget=0 vBorder parent.w (parent.h - buttonHeight - 8 - 2 * vBor
opYoffset=vBorder
gameoptions_id=gox (opYoffset + 2) gameOptionsLabelWidth kLineHeight
gameoptions_id.align=kTextAlignRight
-gameoptions_domain=prev.x2 (prev.y - 1) (gow - prev.w) (prev.h + 2)
-opYoffset=(opYoffset + kLineHeight + 8)
+gameoptions_domain=prev.x2 (prev.y - 1) (gow - prev.w) kPopUpHeight
+opYoffset=(opYoffset + kLineHeight + 10)
gameoptions_name=gox (opYoffset + 2) gameOptionsLabelWidth kLineHeight
gameoptions_name.align=kTextAlignRight
-gameoptions_desc=prev.x2 (prev.y - 1) (gow - prev.w) (prev.h + 2)
+gameoptions_desc=prev.x2 (prev.y - 1) (gow - prev.w) kPopUpHeight
opYoffset=(opYoffset + kLineHeight + 12)
-gameoptions_lang=gox (opYoffset - 1) gow (kLineHeight + 2)
+gameoptions_lang=gox (opYoffset - 1) gow kPopUpHeight
opYoffset=(opYoffset + kLineHeight + 8)
gameoptions_platform=prev.x opYoffset prev.w prev.h
opYoffset=(opYoffset + kLineHeight + 8)
@@ -397,7 +411,7 @@ chooser_ok=(prev.x2 + 10) prev.y prev.w prev.h
[graphicsControls]
gcx=(opXoffset + 10)
gcw=(parent.w - gcx - 25)
-grModePopup=(gcx - 5) (opYoffset - 1) (gcw + 5) (kLineHeight + 2)
+grModePopup=(gcx - 5) (opYoffset - 1) (gcw + 5) kPopUpHeight
opYoffset=(opYoffset + kLineHeight + 8)
grRenderPopup=prev.x (opYoffset - 1) prev.w prev.h
opYoffset=(opYoffset + kLineHeight + 12)
@@ -409,7 +423,7 @@ opYoffset=(opYoffset + buttonHeight + 4)
[audioControls]
aux=(opXoffset + 10)
auw=(parent.w - aux - 30)
-auMidiPopup=(aux) (opYoffset - 1) (auw + 5) (kLineHeight + 2)
+auMidiPopup=(aux) (opYoffset - 1) (auw + 5) kPopUpHeight
opYoffset=(opYoffset + buttonHeight + 4)
[volumeControls]