ManaPlus
|
#include <textpreview.h>
Public Member Functions | |
TextPreview (const Widget2 *const widget, const std::string &text) | |
~TextPreview () | |
void | setTextColor (const Color *color) |
void | setTextColor2 (const Color *color) |
void | useTextAlpha (const bool alpha) |
void | setTextBGColor (const Color *color) |
void | setBGColor (const Color *color) |
void | setFont (Font *const font) |
void | setShadow (const bool shadow) |
void | setOutline (const bool outline) |
void | draw (Graphics *const graphics) |
void | safeDraw (Graphics *const graphics) |
void | setOpaque (const Opaque opaque) |
bool | isOpaque () const |
void | adjustSize () |
Public Member Functions inherited from Widget | |
Widget (const Widget2 *const widget) | |
~Widget () | |
virtual void | drawFrame (Graphics *graphics) |
virtual void | safeDrawFrame (Graphics *graphics) |
void | setFrameSize (const unsigned int frameSize) |
unsigned int | getFrameSize () const |
virtual void | logic () |
Widget * | getParent () const |
void | setWidth (const int width) |
int | getWidth () const |
void | setHeight (const int height) |
int | getHeight () const |
void | setSize (const int width, const int height) |
void | setX (const int x) |
int | getX () const |
void | setY (const int y) |
int | getY () const |
void | setPosition (const int x, const int y) |
void | setDimension (const Rect &dimension) |
const Rect & | getDimension () const |
void | setFocusable (const bool focusable) |
bool | isFocusable () const |
virtual bool | isFocused () const |
void | setEnabled (const bool enabled) |
bool | isEnabled () const |
void | setVisible (Visible visible) |
bool | isVisible () const |
void | setBaseColor (const Color &color) |
const Color & | getBaseColor () const |
void | setForegroundColor (const Color &color) |
const Color & | getForegroundColor () const |
void | setBackgroundColor (const Color &color) |
const Color & | getBackgroundColor () const |
virtual void | requestFocus () |
virtual void | requestMoveToTop () |
virtual void | requestMoveToBottom () |
virtual void | setFocusHandler (FocusHandler *const focusHandler) |
FocusHandler * | getFocusHandler () |
void | addActionListener (ActionListener *const actionListener) |
void | removeActionListener (ActionListener *const actionListener) |
void | addDeathListener (WidgetDeathListener *const deathListener) |
void | removeDeathListener (WidgetDeathListener *const deathListener) |
void | addMouseListener (MouseListener *const mouseListener) |
void | removeMouseListener (MouseListener *const mouseListener) |
void | addKeyListener (KeyListener *const keyListener) |
void | removeKeyListener (KeyListener *const keyListener) |
void | addFocusListener (FocusListener *const focusListener) |
void | removeFocusListener (FocusListener *const focusListener) |
void | addWidgetListener (WidgetListener *const widgetListener) |
void | removeWidgetListener (WidgetListener *const widgetListener) |
void | setActionEventId (const std::string &actionEventId) |
const std::string & | getActionEventId () const |
virtual void | getAbsolutePosition (int &x, int &y) const |
virtual void | setParent (Widget *parent) |
Font * | getFont () const |
void | setFont (Font *const font) |
virtual void | fontChanged () |
bool | isTabInEnabled () const |
void | setTabInEnabled (const bool enabled) |
bool | isTabOutEnabled () const |
void | setTabOutEnabled (const bool enabled) |
void | requestModalFocus () |
virtual void | requestModalMouseInputFocus () |
virtual void | releaseModalFocus () |
virtual void | releaseModalMouseInputFocus () |
virtual bool | isModalFocused () const |
virtual bool | isModalMouseInputFocused () const |
virtual Widget * | getWidgetAt (int x, int y) |
const std::list< MouseListener * > & | getMouseListeners () const A_CONST |
const std::list< KeyListener * > & | getKeyListeners () const A_CONST |
const std::list< FocusListener * > & | getFocusListeners () const A_CONST |
virtual Rect | getChildrenArea () |
virtual FocusHandler * | getInternalFocusHandler () |
void | setInternalFocusHandler (FocusHandler *const internalFocusHandler) |
virtual void | moveToTop (Widget *widget) |
virtual void | moveToBottom (Widget *widget) |
virtual void | focusNext () |
virtual void | focusPrevious () |
virtual void | showWidgetPart (Widget *const widget, const Rect &area) |
void | setId (const std::string &id) |
const std::string & | getId () const |
virtual void | showPart (const Rect &rectangle) |
bool | isAllowLogic () const |
void | setMouseConsume (const bool b) |
bool | isMouseConsume () const |
void | setRedraw (const bool b) |
virtual bool | isSelectable () const |
void | setSelectable (const bool selectable) |
void | windowResized () |
virtual void | postInit () |
Public Member Functions inherited from Widget2 | |
virtual | ~Widget2 () |
const Color & | getThemeColor (const ThemeColorIdT type, const unsigned int alpha) const A_INLINE |
const Color & | getThemeCharColor (const signed char c, bool &valid) const A_INLINE |
virtual void | setWidget2 (const Widget2 *const widget) |
void | setPalette (int palette) |
void | checkPalette () |
void | setForegroundColor2 (const Color &color) |
Widget * | getWindow () const |
virtual void | setWindow (Widget *const window) |
Private Attributes | |
Font * | mFont |
std::string | mText |
const Color * | mTextColor |
const Color * | mTextColor2 |
const Color * | mBGColor |
const Color * | mTextBGColor |
int | mPadding |
bool | mTextAlpha |
Opaque | mOpaque |
bool | mShadow |
bool | mOutline |
Static Private Attributes | |
static int | instances = 0 |
static float | mAlpha = 1.0 |
static Skin * | mSkin = 0 |
Preview widget for particle colors, etc.
Definition at line 36 of file textpreview.h.
TextPreview::TextPreview | ( | const Widget2 *const | widget, |
const std::string & | text | ||
) |
Definition at line 41 of file textpreview.cpp.
References adjustSize(), Skin::getOption(), Theme::getThemePath(), instances, Theme::load(), Widget::mAllowLogic, mPadding, mSkin, and theme.
TextPreview::~TextPreview | ( | ) |
Definition at line 76 of file textpreview.cpp.
References gui, instances, mSkin, Gui::removeDragged(), theme, and Theme::unload().
void TextPreview::adjustSize | ( | ) |
Definition at line 154 of file textpreview.cpp.
References Widget::getFont(), Widget::getHeight(), mPadding, and Widget::setHeight().
Referenced by setTextColor(), setTextColor2(), and TextPreview().
|
virtual |
Widget's draw method. Does the actual job.
graphics | graphics to draw into |
Implements Widget.
Definition at line 90 of file textpreview.cpp.
References Color::b, BLOCK_END, BLOCK_START, CAST_S32, Font::drawString(), Graphics::fillRectangle(), Color::g, Font::getHeight(), Widget2::getThemeColor(), Font::getWidth(), Settings::guiAlpha, Rect::height, mAlpha, mBGColor, Widget::mDimension, mFont, mOpaque, mOutline, mPadding, mShadow, mText, mTextAlpha, mTextBGColor, mTextColor, mTextColor2, Opaque_true, Color::r, Graphics::setColor(), settings, Rect::width, x, and y.
Referenced by safeDraw().
|
inline |
Gets opacity for this widget (whether or not the background color is shown below the widget)
Definition at line 123 of file textpreview.h.
References mOpaque, and Opaque_true.
|
virtual |
|
inline |
Sets the background color of the widget.
color | the color to set |
Definition at line 74 of file textpreview.h.
References mBGColor.
Referenced by Setup_Colors::valueChanged().
|
inline |
Sets the font to render the text in.
font | the font to use. |
Definition at line 82 of file textpreview.h.
References mFont.
Referenced by Setup_Colors::valueChanged().
|
inline |
Set opacity for this widget (whether or not to show the background color)
opaque | Whether the widget should be opaque or not |
Definition at line 116 of file textpreview.h.
References mOpaque.
Referenced by Setup_Colors::valueChanged().
|
inline |
Sets whether to use an outline while rendering.
outline | true, if an outline is wanted, false else |
Definition at line 98 of file textpreview.h.
References mOutline.
Referenced by Setup_Colors::valueChanged().
|
inline |
Sets whether to use a shadow while rendering.
shadow | true, if a shadow is wanted, false else |
Definition at line 90 of file textpreview.h.
References mShadow.
Referenced by Setup_Colors::valueChanged().
|
inline |
Sets the color the text background is drawn in. This is only the rectangle directly behind the text, not to full widget.
color | the color to set |
Definition at line 66 of file textpreview.h.
References mTextBGColor.
Referenced by Setup_Colors::valueChanged().
|
inline |
Definition at line 46 of file textpreview.h.
References adjustSize(), and mTextColor.
Referenced by Setup_Colors::valueChanged().
|
inline |
|
inline |
Sets the text to use the set alpha value.
alpha | whether to use alpha values for the text or not |
Definition at line 57 of file textpreview.h.
References mTextAlpha.
Referenced by Setup_Colors::valueChanged().
|
staticprivate |
Definition at line 136 of file textpreview.h.
Referenced by TextPreview(), and ~TextPreview().
|
staticprivate |
Definition at line 137 of file textpreview.h.
Referenced by draw().
|
private |
Definition at line 133 of file textpreview.h.
Referenced by draw(), and setBGColor().
|
private |
Definition at line 129 of file textpreview.h.
|
private |
Definition at line 140 of file textpreview.h.
Referenced by draw(), isOpaque(), and setOpaque().
|
private |
Definition at line 142 of file textpreview.h.
Referenced by draw(), and setOutline().
|
private |
Definition at line 135 of file textpreview.h.
Referenced by adjustSize(), draw(), and TextPreview().
|
private |
Definition at line 141 of file textpreview.h.
Referenced by draw(), and setShadow().
|
staticprivate |
Definition at line 138 of file textpreview.h.
Referenced by TextPreview(), and ~TextPreview().
|
private |
Definition at line 130 of file textpreview.h.
Referenced by draw().
|
private |
Definition at line 139 of file textpreview.h.
Referenced by draw(), and useTextAlpha().
|
private |
Definition at line 134 of file textpreview.h.
Referenced by draw(), and setTextBGColor().
|
private |
Definition at line 131 of file textpreview.h.
Referenced by draw(), and setTextColor().
|
private |
Definition at line 132 of file textpreview.h.
Referenced by draw(), and setTextColor2().