File: stepstyle.h

package info (click to toggle)
mysql-navigator 1.2.4-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,756 kB
  • ctags: 1,058
  • sloc: cpp: 11,213; makefile: 46; sh: 24; sql: 11
file content (164 lines) | stat: -rw-r--r-- 7,316 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/***************************************************************************
  stepstyle.h
  version 0.1
  -------------------
  description   A Qt style that attempts to imitate the look and
                feel of the NeXT platform. However, the imitation
                deviates from NeXT in several areas, so it is up
                to the user to implement an appropriate layout
                for the best effect.
  -------------------
  begin         Tue Feb 15 2000
  author        David Johnson <david@usermode.org>
  -------------------
  Copyright 2000, David Johnson
  All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

  3. Neither name of the copyright holders nor the names of its contributors may
  be used to endorse or promote products derived from this software without
  specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ***************************************************************************/

#ifndef STEPSTYLE_H
#define STEPSTYLE_H

#include <qwindowsstyle.h>
#include <qpalette.h>

/**
  * A Qt style that attempts to imitate the look and feel of the NeXT platform.
  * However, the imitation deviates from NeXT in several areas, so it is up
  * to the user to implement an appropriate layout for the best effect.
  *
  * This class uses the same API as the QStyle family of classes. Fuller
  * descriptions of these methods can be obtained from the Qt documentation.
  */

class StepStyle : public QWindowsStyle
{
  Q_OBJECT
public:
    /** Constructor */
    StepStyle();
    /** Destructor */
    virtual ~StepStyle();

    /** Initialize the appearance of the style */
    void polish(QPalette& pal);
    void polish(QWidget *w);
    void polish(QApplication *a);
    /** Restores the appearance of the style */
    void unPolish(QPalette& pal);
    void unPolish(QWidget *w);
    void unPolish(QApplication *a);

    /** Draws the basic button */
    void drawButton(QPainter *p, int x, int y, int w, int h,
                const QColorGroup &g, bool sunken = false, const QBrush *fill = 0);
    /** Draws a beveled button */
    void drawBevelButton(QPainter *p, int x, int y, int w, int h,
                const QColorGroup &g, bool sunken = false, const QBrush *fill = 0);
    /** Draws a push button */
    void drawPushButton(QPushButton* b, QPainter *p);
    /** Draws the label for a pushbutton */
    void drawPushButtonLabel(QPushButton* b, QPainter *p);
    /** Shift button contents when pressed */
    void getButtonShift(int &x, int &y);

    /** Draws a combo button */
    void drawComboButton(QPainter *p, int x, int y, int w, int h,
                const QColorGroup &g, bool sunken = false, bool editable = false,
                bool enabled = true, const QBrush *fill = 0);
    /** Returns the rectangle for the contents of a combo box */
    QRect comboButtonRect(int x, int y, int w, int h);
    /** Returns the focus rectangle for a combo box */
    QRect comboButtonFocusRect(int x, int y, int w, int h);

    /** Draws a checkbox indicator */
    void drawIndicator(QPainter* p, int x, int y, int w, int h, const QColorGroup &g,
                int state, bool down = true, bool enabled = true);
    /** Returns the size of a checkbox */
    QSize indicatorSize() const;

    /** Draws a radio button indicator */
    void drawExclusiveIndicator(QPainter* p,  int x, int y, int w, int h, const QColorGroup &g,
                bool on, bool down = false, bool enabled = true);
    /** Returns the size of a radio button indicator */
    QSize exclusiveIndicatorSize() const;
	
    /** Draws a scrollbar */
    void drawScrollBarControls(QPainter*, const QScrollBar*, int sliderStart, uint controls,
                uint activeControl);
    /** Returns the metrics of a scrollbar */
    void scrollBarMetrics(const QScrollBar*, int&, int&, int&, int&);
    /** Returns the scrollbar control the mouse is over */
    ScrollControl scrollBarPointOver(const QScrollBar* sb, int sliderStart, const QPoint& p);

    /** Draws a slider 'knob' */
    void drawSlider(QPainter *p, int x, int y, int w, int h,
                const QColorGroup &g, Orientation, bool tickabove, bool tickbelow);
    /** Returns the length of a slider */
    int sliderLength() const;
    /** Draws the slider 'groove' */
    void drawSliderGroove(QPainter *p, int x, int y, int w, int h,
                const QColorGroup& g, QCOORD c, Orientation);
    /** Distance the mouse can move before the slider "pops' back */
    int maximumSliderDragDistance() const;

    /** Draws a menu item */
    void drawPopupMenuItem(QPainter* p, bool checkable, int maxpmw, int tab, QMenuItem* mi,
                const QPalette& pal, bool act, bool enabled, int x, int y, int w, int h);

    /** Draws a tabbar tab */
    void drawTab(QPainter* p, const QTabBar* tb, QTab* t, bool selected);

    /** Draws a splitter */
    void drawSplitter(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, Orientation);
    /** Returns the width of a splitter */
    int splitterWidth() const;

    /** Draws a panel */
    void drawPanel(QPainter *p, int x, int y, int w, int h,
                const QColorGroup &cg, bool sunken, int lineWidth, const QBrush *fill);

    /** Draws a focus rectangle */
    void drawFocusRect(QPainter* p, const QRect& r, const QColorGroup &g, const QColor* bg, bool atBorder);

protected:
    /** Draws a NeXT style arrow */
    void drawArrow(QPainter *p, Qt::ArrowType type, bool down, int x,
                int y, int w, int h, const QColorGroup &g, bool enabled, const QBrush *);
    /** Draws a NeXT style 'dot' */
    void drawCircle(QPainter* p,  int x, int y, int w, int h, const QColorGroup &g);
    /** Draws the background of the scrollbar */
    void drawScrollBarGroove(QPainter *p, QRect r, const QWidget *sb, const QColorGroup &g);
    /** Draws a checkmark */
    void drawCheckMark(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool act, bool dis);

private:
    QPalette savePalette;   // save the palette during polish
    QPalette pal;           // a working palette
};

#endif // STEPSTYLE_H