summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-sheet/cellformat.h
Unidiff
Diffstat (limited to 'noncore/apps/opie-sheet/cellformat.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/cellformat.h142
1 files changed, 82 insertions, 60 deletions
diff --git a/noncore/apps/opie-sheet/cellformat.h b/noncore/apps/opie-sheet/cellformat.h
index b569b7f..e07af9c 100644
--- a/noncore/apps/opie-sheet/cellformat.h
+++ b/noncore/apps/opie-sheet/cellformat.h
@@ -1,120 +1,142 @@
1/*************************************************************************** 1/*
2 * * 2 =. This file is part of the Opie Project
3 * This program is free software; you can redistribute it and/or modify * 3 .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org>
4 * it under the terms of the GNU General Public License as published by * 4 .>+-=
5 * the Free Software Foundation; either version 2 of the License, or * 5 _;:, .> :=|. This program is free software; you can
6 * (at your option) any later version. * 6.> <`_, > . <= redistribute it and/or modify it under
7 * * 7:`=1 )Y*s>-.-- : the terms of the GNU General Public
8 ***************************************************************************/ 8.="- .-=="i, .._ License as published by the Free Software
9 - . .-<_> .<> Foundation; either version 2 of the License,
10 ._= =} : or (at your option) any later version.
11 .%`+i> _;_.
12 .i_,=:_. -<s. This program is distributed in the hope that
13 + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
14 : .. .:, . . . without even the implied warranty of
15 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
16 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.= = ; Library General Public License for more
18++= -. .` .: details.
19 : = ...= . :.=-
20 -. .:....=;==+<; You should have received a copy of the GNU
21 -_. . . )=. = Library General Public License along with
22 -- :-=` this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
9 28
10/* 29/*
11 * Opie Sheet (formerly Sheet/Qt) 30 * Opie Sheet (formerly Sheet/Qt)
12 * by Serdar Ozler <sozler@sitebest.com> 31 * by Serdar Ozler <sozler@sitebest.com>
13 */ 32 */
14 33
15#ifndef CELLFORMAT_H 34#ifndef CELLFORMAT_H
16#define CELLFORMAT_H 35#define CELLFORMAT_H
17 36
37#include "sheet.h"
38
39/* OPIE */
18#include <qpe/fontdatabase.h> 40#include <qpe/fontdatabase.h>
41
42/* QT */
19#include <qdialog.h> 43#include <qdialog.h>
20#include <qtabwidget.h> 44#include <qtabwidget.h>
21#include <qlayout.h> 45#include <qlayout.h>
22#include <qcombobox.h> 46#include <qcombobox.h>
23#include <qcheckbox.h> 47#include <qcheckbox.h>
24#include <qpushbutton.h> 48#include <qpushbutton.h>
25 49
26#include "sheet.h"
27
28class BorderEditor: public QFrame 50class BorderEditor: public QFrame
29{ 51{
30 Q_OBJECT 52 Q_OBJECT
31 53
32 // QT objects 54 // QT objects
33 QPen penTop, penBottom, penLeft, penRight, penHorz, penVert; 55 QPen penTop, penBottom, penLeft, penRight, penHorz, penVert;
34 56
35 // Private functions 57 // Private functions
36 void drawContents(QPainter *p); 58 void drawContents(QPainter *p);
37 59
38 // Reimplemented QFrame functions 60 // Reimplemented QFrame functions
39 void mouseReleaseEvent(QMouseEvent *e); 61 void mouseReleaseEvent(QMouseEvent *e);
40 62
41 public: 63public:
42 // Definitions 64 // Definitions
43 enum BorderArea {None, Top, Bottom, Left, Right, Horz, Vert}; 65 enum BorderArea {None, Top, Bottom, Left, Right, Horz, Vert};
44 66
45 BorderEditor(QWidget *parent=0); 67 BorderEditor(QWidget *parent=0);
46 ~BorderEditor(); 68 ~BorderEditor();
47 69
48 void setPen(const QPen &pen, BorderArea area); 70 void setPen(const QPen &pen, BorderArea area);
49 QPen getPen(BorderArea area); 71 QPen getPen(BorderArea area);
50 QPen getDefaultPen() { return QPen(Qt::black, 1, Qt::DotLine); } 72 QPen getDefaultPen() { return QPen(Qt::black, 1, Qt::DotLine); }
51 73
52 signals: 74signals:
53 void clicked(BorderEditor::BorderArea); 75 void clicked(BorderEditor::BorderArea);
54}; 76};
55 77
56class CellFormat: public QDialog 78class CellFormat: public QDialog
57{ 79{
58 Q_OBJECT 80 Q_OBJECT
59 81
60 enum comboType {COMBO_OTHER, COMBO_WIDTH, COMBO_FONT, COMBO_SIZE, COMBO_STYLE, COMBO_COLOR, COMBO_VALIGN, COMBO_HALIGN}; 82 enum comboType {COMBO_OTHER, COMBO_WIDTH, COMBO_FONT, COMBO_SIZE, COMBO_STYLE, COMBO_COLOR, COMBO_VALIGN, COMBO_HALIGN};
61 83
62 // QT objects 84 // QT objects
63 QBoxLayout *box; 85 QBoxLayout *box;
64 QTabWidget *tabs; 86 QTabWidget *tabs;
65 QWidget *widgetBorders, *widgetBackground, *widgetFont, *widgetAlignment; 87 QWidget *widgetBorders, *widgetBackground, *widgetFont, *widgetAlignment;
66 QComboBox *comboBordersWidth, *comboBordersColor, *comboBackgroundColor, *comboBackgroundStyle, *comboFontColor, *comboFontSize, *comboFontFamily, *comboAlignmentVertical, *comboAlignmentHorizontal; 88 QComboBox *comboBordersWidth, *comboBordersColor, *comboBackgroundColor, *comboBackgroundStyle, *comboFontColor, *comboFontSize, *comboFontFamily, *comboAlignmentVertical, *comboAlignmentHorizontal;
67 QCheckBox *checkFontBold, *checkFontItalic, *checkAlignmentWrap; 89 QCheckBox *checkFontBold, *checkFontItalic, *checkAlignmentWrap;
68 QPushButton *buttonBordersDefaults, *buttonBackgroundDefaults, *buttonFontDefaults, *buttonAlignmentDefaults; 90 QPushButton *buttonBordersDefaults, *buttonBackgroundDefaults, *buttonFontDefaults, *buttonAlignmentDefaults;
69 QFrame *frameBackground, *frameFont, *frameAlignment; 91 QFrame *frameBackground, *frameFont, *frameAlignment;
70 QBrush brushBackground; 92 QBrush brushBackground;
71 QFont fontFont; 93 QFont fontFont;
72 QColor fontColor; 94 QColor fontColor;
73 Qt::AlignmentFlags textAlignment; 95 Qt::AlignmentFlags textAlignment;
74 FontDatabase fontDB; 96 FontDatabase fontDB;
75 97
76 // Other objects & variables 98 // Other objects & variables
77 Sheet *sheet; 99 Sheet *sheet;
78 BorderEditor *borderEditor; 100 BorderEditor *borderEditor;
79 bool changedFont, changedAlign, changedBrush; 101 bool changedFont, changedAlign, changedBrush;
80 102
81 // Private functions 103 // Private functions
82 void createWidthCombo(QComboBox *combo); 104 void createWidthCombo(QComboBox *combo);
83 void createFontCombo(QComboBox *combo); 105 void createFontCombo(QComboBox *combo);
84 void createHAlignCombo(QComboBox *combo); 106 void createHAlignCombo(QComboBox *combo);
85 void createVAlignCombo(QComboBox *combo); 107 void createVAlignCombo(QComboBox *combo);
86 void createStyleCombo(QComboBox *combo); 108 void createStyleCombo(QComboBox *combo);
87 void createSizeCombo(QComboBox *combo); 109 void createSizeCombo(QComboBox *combo);
88 void createColorCombo(QComboBox *combo); 110 void createColorCombo(QComboBox *combo);
89 QComboBox *createCombo(comboType type, QWidget *parent, const QString &caption, int y); 111 QComboBox *createCombo(comboType type, QWidget *parent, const QString &caption, int y);
90 112
91 int findHAlignIndex(Qt::AlignmentFlags flag); 113 int findHAlignIndex(Qt::AlignmentFlags flag);
92 int findVAlignIndex(Qt::AlignmentFlags flag); 114 int findVAlignIndex(Qt::AlignmentFlags flag);
93 int findComboItemIndex(QComboBox *combo, const QString &item); 115 int findComboItemIndex(QComboBox *combo, const QString &item);
94 int findColorIndex(const QColor &color); 116 int findColorIndex(const QColor &color);
95 int findBrushStyleIndex(Qt::BrushStyle style); 117 int findBrushStyleIndex(Qt::BrushStyle style);
96 118
97 private slots: 119private slots:
98 void borderClicked(BorderEditor::BorderArea area); 120 void borderClicked(BorderEditor::BorderArea area);
99 void backgroundClicked(int index); 121 void backgroundClicked(int index);
100 void fontClicked(bool on); 122 void fontClicked(bool on);
101 void fontClicked(int index); 123 void fontClicked(int index);
102 void alignClicked(bool on); 124 void alignClicked(bool on);
103 void alignClicked(int index); 125 void alignClicked(int index);
104 void slotBordersDefaults(); 126 void slotBordersDefaults();
105 void slotBackgroundDefaults(); 127 void slotBackgroundDefaults();
106 void slotFontDefaults(); 128 void slotFontDefaults();
107 void slotAlignmentDefaults(); 129 void slotAlignmentDefaults();
108 130
109 public: 131public:
110 CellFormat(QWidget *parent=0); 132 CellFormat(QWidget *parent=0);
111 ~CellFormat(); 133 ~CellFormat();
112 134
113 int exec(Sheet *s); 135 int exec(Sheet *s);
114 136
115 void setTextAlign(Qt::AlignmentFlags flags); 137 void setTextAlign(Qt::AlignmentFlags flags);
116 void setTextFont(const QFont &font, const QColor &color); 138 void setTextFont(const QFont &font, const QColor &color);
117 void setBrushBackground(const QBrush &brush); 139 void setBrushBackground(const QBrush &brush);
118}; 140};
119 141
120#endif 142#endif