#include <ZPushButton.h>
Inheritance diagram for ZPushButton::
Public Types | |
enum | Flags { NoFlags = 0, CSTStyle = 0, JoinLeft = 1, JoinRight = 2, DialogSyle = 4 } |
used in constructor to determine what the left and right side of the button look like. More... | |
Public Slots | |
virtual void | polish () |
reimplemented. More... | |
Public Methods | |
ZPushButton (QWidget *parent, int flags=0, int width=-1, int height=-1) | |
create a pushbutton. More... | |
ZPushButton (const QString &resourceID, QWidget *parent, int flags=0, int width=-1, int height=-1) | |
create a pushbutton. More... | |
ZPushButton (const QString &resourceID, const QString &overlayText, QWidget *parent, int flags=0, int width=-1, int height=-1) | |
create a pushbutton. More... | |
virtual QSize | sizeHint () const |
reimplemented. More... | |
virtual void | setMinimumSize (int minw, int minh) |
reimplemented. More... | |
virtual void | setGeometry (int x, int y, int w, int h) |
reimplemented. More... | |
virtual void | setGeometry (const QRect &) |
reimplemented. More... | |
virtual void | resize (int w, int h) |
reimplemented. More... | |
virtual void | resize (const QSize &) |
reimplemented. More... | |
virtual void | setText (const QString &text) |
set the overlay text. More... | |
virtual QString | text () const |
get the overlay text. More... | |
void | setPopup (QPopupMenu *popup) |
Set an a popup menu that shows when this button is pressed. More... | |
void | setResourceID (const QString &resourceID) |
set the resourceID for this button. More... | |
QString | resourceID () const |
returns the resourceID for this button. More... | |
void | setFlags (int flags) |
set the pushbutton flags. More... | |
int | flags () const |
returns the flags for this button. More... | |
Protected Slots | |
virtual void | popupPressed () |
reimplemented. More... | |
Protected Methods | |
virtual void | drawButton (QPainter *) |
void | init (const QString &resourceID, const QString &overlayText, int flags, int width, int height) |
initializers called by the various constructors. More... | |
QPixmap | normal () const |
used for getting/drawing the actual button. More... | |
QPixmap | normalPixmap () const |
QPixmap | normalOverlay () const |
QPixmap | normalOverlayPixmap () const |
QPixmap | active () const |
QPixmap | activePixmap () const |
QPixmap | activeOverlay () const |
QPixmap | activeOverlayPixmap () const |
QPixmap | disabled () const |
QPixmap | disabledPixmap () const |
QPixmap | disabledOverlay () const |
QPixmap | disabledOverlayPixmap () const |
void | dim1 (ZDirectPixmap &img, int x, int y, int h) const |
fast fixed-amount alpha blending functions for left and right edges. More... | |
void | dim2 (ZDirectPixmap &img, int x, int y, int h) const |
void | dim3 (ZDirectPixmap &img, int x, int y, int h) const |
void | dim4 (ZDirectPixmap &img, int x, int y, int h) const |
void | dim5 (ZDirectPixmap &img, int x, int y, int h) const |
void | drawHLine (ZDirectPixmap &img, int x, int y, int w, const QColor &wc) const |
line functions for drawing button edges. More... | |
void | drawVLine (ZDirectPixmap &img, int x, int y, int h, const QColor &wc) const |
void | drawGrad (ZDirectPixmap &img, int x, int y, int w, int h, const QColor &start, const QColor &end) const |
gradient fill for tactium buttons. More... | |
QPixmap | drawNormal () const |
draw it when no PM is available. More... | |
QPixmap | drawActive () const |
draw it when no PM is available. More... | |
QPixmap | fade (const QPixmap &) const |
fade input pixmap. More... | |
Protected Attributes | |
bool | m_guessSize |
true if user hasn't specified size. More... | |
bool | m_isSizeCached |
if size has already been calculated. More... | |
int | m_cachedWidth |
cached width. More... | |
int | m_cachedHeight |
cached height. More... | |
QString | m_resourceID |
same as normalResourceID. More... | |
QString | m_overlayText |
text overlaid on top of the normal pixmap. More... | |
int | m_flags |
flags used when rendering the button. More... | |
bool | m_pressed |
current button state. More... | |
Static Protected Attributes | |
const int | minWidth |
minimum width. More... | |
const int | minHeight |
minimum height. More... | |
const int | defaultWidth |
default width. More... | |
const int | defaultHeight |
default height. More... | |
const unsigned char | multSixTenths [] |
table to multiply everything by 6/10. More... |
A ZPushButton has three states:
1. normal -- the button is not pressed and not disabled 2. active -- the button is pressed 3. disabled -- the button is diabled
Each state is drawn by two operations. The first operation draws the background of the button, and the second draws an overlay on top of that background.
If ZPushButton finds a pixmap for the button background in the skin, it will load it. If not, ZPushButton will draw the background in the style of a Context-Sensitive Toolbar (CST) button.
If ZPushButton finds an overlay pixmap in the skin, it will load it. If not, and the user has specified overlay text, ZPushButton will use the text. If the user has not specified any text, ZPushButton will only draw the background.
If ZPushButton can not find a disabled pixmap in the skin, it will 'dim' the normal pixmap.
This means a button can be specified by zero to six pixmaps, as below:
CamV_PhotoAlbum_O.g -- overlay to display when button not pressed CamV_PhotoAlbum_OA.g -- overlay to display when button pressed CamV_PhotoAlbum_OD.g -- overlay to display when button disabled CamV_PhotoAlbum.g-- background when button enabled and not pressed CamV_PhotoAlbum_A.g -- background when button enabled and pressed CamV_PhotoAlbum_D.g -- background when button disabled.
(Note: .jpg, .png, .gif, files are all stored as .g)
Here are some other options:
|
used in constructor to determine what the left and right side of the button look like. If there is another ZPushButton directly to the left, then this button should have the JoinLeft flag set and the button to the left should have the JoinRight flag set. This will give the buttons a nice appearance at the line where they join. |
|
create a pushbutton.
|
|
create a pushbutton.
|
|
create a pushbutton.
|
|
|
|
|
|
|
|
|
|
fast fixed-amount alpha blending functions for left and right edges.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw it when no PM is available.
|
|
|
|
gradient fill for tactium buttons.
|
|
line functions for drawing button edges.
|
|
draw it when no PM is available.
|
|
|
|
fade input pixmap.
|
|
returns the flags for this button.
|
|
initializers called by the various constructors.
|
|
used for getting/drawing the actual button.
|
|
|
|
|
|
|
|
reimplemented.
|
|
reimplemented.
|
|
reimplemented.
|
|
reimplemented.
|
|
returns the resourceID for this button.
|
|
set the pushbutton flags.
|
|
reimplemented.
|
|
reimplemented.
|
|
reimplemented.
|
|
Set an a popup menu that shows when this button is pressed.
|
|
set the resourceID for this button.
|
|
set the overlay text.
|
|
reimplemented.
|
|
get the overlay text.
|
|
default height.
|
|
default width.
|
|
cached height.
|
|
cached width.
|
|
flags used when rendering the button.
|
|
true if user hasn't specified size.
|
|
if size has already been calculated.
|
|
text overlaid on top of the normal pixmap.
|
|
current button state.
|
|
same as normalResourceID.
|
|
minimum height.
|
|
minimum width.
|
|
table to multiply everything by 6/10.
|