summaryrefslogtreecommitdiff
path: root/src/gui/widgets/textpreview.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/textpreview.h')
-rw-r--r--src/gui/widgets/textpreview.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h
index 1c1fa1e4..e7b7db80 100644
--- a/src/gui/widgets/textpreview.h
+++ b/src/gui/widgets/textpreview.h
@@ -29,7 +29,8 @@
/**
* Preview widget for particle colors, etc.
*/
-class TextPreview : public gcn::Widget {
+class TextPreview : public gcn::Widget
+{
public:
TextPreview(const std::string* text);
@@ -44,6 +45,16 @@ class TextPreview : public gcn::Widget {
}
/**
+ * Sets the text to use the set alpha value.
+ *
+ * @param alpha whether to use alpha values for the text or not
+ */
+ inline void useTextAlpha(bool alpha)
+ {
+ mTextAlpha = alpha;
+ }
+
+ /**
* Sets the color the text background is drawn in. This is only the
* rectangle directly behind the text, not to full widget.
*
@@ -101,12 +112,29 @@ class TextPreview : public gcn::Widget {
*/
void draw(gcn::Graphics *graphics);
+ /**
+ * Set opacity for this widget (whether or not to show the background
+ * color)
+ *
+ * @param opaque Whether the widget should be opaque or not
+ */
+ void setOpaque(bool opaque) { mOpaque = opaque; }
+
+ /**
+ * Gets opacity for this widget (whether or not the background color
+ * is shown below the widget)
+ */
+ bool isOpaque() { return mOpaque; }
+
private:
gcn::Font *mFont;
const std::string* mText;
const gcn::Color* mTextColor;
const gcn::Color* mBGColor;
const gcn::Color* mTextBGColor;
+ static float mAlpha;
+ bool mTextAlpha;
+ bool mOpaque;
bool mShadow;
bool mOutline;
};