~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to lib/kofficeui/kcoloractions.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* This file is part of the KDE libraries
2
2
    Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
 
3
    Copyright (C) 2002 Werner Trobin <trobin@kde.org>
3
4
 
4
5
    This library is free software; you can redistribute it and/or
5
6
    modify it under the terms of the GNU Library General Public
20
21
#define kcoloractions_h
21
22
 
22
23
#include <kaction.h>
23
 
#include <qvaluelist.h>
24
 
#include <qwidget.h>
25
 
 
26
 
class QMouseEvent;
27
 
class QPaintEvent;
28
24
 
29
25
/**
30
 
 * An action whose pixmap is automatically generated from a color
 
26
 * An action whose pixmap is automatically generated from a color.
31
27
 * It knows three types of pixmaps: text color, frame color and background color
32
28
 */
33
29
class KColorAction : public KAction
65
61
 
66
62
    QColor col;
67
63
    Type typ;
68
 
 
69
64
};
70
65
 
71
 
/**
72
 
 * An improved version of KColorAction, which also features a delayed popupmenu
73
 
 * for changing the color (make sure to test color() in your slot).
74
 
 */
75
 
class KSelectColorAction : public KColorAction
 
66
 
 
67
class KSelectColorAction : public KAction
76
68
{
77
 
  Q_OBJECT
 
69
    Q_OBJECT
78
70
public:
 
71
    enum Type {
 
72
        TextColor,
 
73
        LineColor,
 
74
        FillColor
 
75
    };
 
76
 
79
77
    KSelectColorAction( const QString& text, Type type,
80
 
                        int accel = 0, QObject* parent = 0, const char* name = 0 );
81
 
    KSelectColorAction( const QString& text, Type type, int accel,
82
 
                        QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
83
 
 
84
 
    ~KSelectColorAction();
85
 
 
86
 
    virtual int plug( QWidget* widget, int index = -1 );
87
 
    KPopupMenu* popupMenu()    { return m_popup; }
88
 
 
89
 
public slots:
90
 
    /**
91
 
     * Displays the color chooser dialog
92
 
     */
93
 
    void changeColor();
94
 
 
95
 
protected:
96
 
    void initPopup();
97
 
 
98
 
private:
99
 
    KPopupMenu *m_popup;
100
 
};
101
 
 
102
 
/**
103
 
 *  class KColorBar
104
 
 *
105
 
 *  Simple toolbar with little color buttons. This Bar can be placed like a normal toolbar.
106
 
 *
107
 
 *  @short Toolbar with color buttons.
108
 
 */
109
 
class KColorBar : public QWidget
110
 
{
111
 
    Q_OBJECT
112
 
 
113
 
public:
114
 
    /**
115
 
     *  Constructor.
116
 
     *
117
 
     *  Initializes the color bar with a list of colors.
118
 
     */
119
 
    KColorBar( const QValueList<QColor> &cols, QWidget *parent, const char *name );
120
 
 
121
 
    Orientation orientation() const { return orient; }
122
 
    
123
 
public slots:
124
 
    void orientationChanged( Orientation o );
125
 
    
126
 
protected:
127
 
    void mousePressEvent( QMouseEvent *e );
128
 
    void paintEvent( QPaintEvent *e );
129
 
 
130
 
private:
131
 
    QValueList<QColor> colors;
132
 
    Orientation orient;
133
 
    
134
 
signals:
135
 
    /**
136
 
     *  This signal gets emitted when the left mouse button is clicked on a color button.
137
 
     */
138
 
    void leftClicked( const QColor &c );
139
 
    /**
140
 
     *  This signal gets emitted when the right mouse button is clicked on a color button.
141
 
     */
142
 
    void rightClicked( const QColor &c );
143
 
 
144
 
};
145
 
 
146
 
class KColorBarAction : public KAction
147
 
{
148
 
    Q_OBJECT
149
 
 
150
 
public:
151
 
    KColorBarAction( const QString &text, int accel,
152
 
                     QObject *receiver, const char *leftClickSlot, const char *rightClickSlot,
153
 
                     const QValueList<QColor> &cols, QObject *parent, const char *name );
154
 
 
155
 
    int plug( QWidget*, int index = -1 );
156
 
 
157
 
signals:
158
 
    void leftClicked( const QColor &c );
159
 
    void rightClicked( const QColor &c );
160
 
 
161
 
private:
162
 
    QValueList<QColor> colors;
163
 
    QObject *receiver;
164
 
    QCString leftClickSlot;
165
 
    QCString rightClickSlot;
 
78
                        const QObject* receiver, const char* slot,
 
79
                        KActionCollection* parent, const char* name );
 
80
    virtual ~KSelectColorAction();
 
81
 
 
82
    virtual int plug( QWidget* w, int index = -1 );
 
83
 
 
84
    QColor color() const;
 
85
    Type type() const;
 
86
 
 
87
public slots:
 
88
    virtual void setColor( const QColor &c );
 
89
    virtual void setType( Type t );
 
90
 
 
91
signals:
 
92
    void colorSelected( const QColor& color );
 
93
 
 
94
private:
 
95
    QString whatsThisWithIcon() const; // duplicated, as it's private in kaction
 
96
 
 
97
    Type m_type;
 
98
    QColor m_color;
166
99
};
167
100
 
168
101
#endif