moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kig / modes / label.h
bloba55ffecb11dba2d975ce5699fc36e4cbb1aa15d3
1 // Copyright (C) 2002 Dominique Devriese <devriese@kde.org>
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
16 // 02111-1307, USA.
18 #ifndef KIG_MODE_LABEL_H
19 #define KIG_MODE_LABEL_H
21 #include "mode.h"
23 #include "../objects/object_calcer.h"
25 #include <vector>
27 class TextLabelWizard;
28 class NormalMode;
29 class Coordinate;
30 class QString;
31 class ObjectPropertyCalcer;
32 class ObjectTypeCalcer;
33 class ObjectCalcer;
35 /**
36 * this is the base class for TextLabelConstructionMode and
37 * TextLabelRedefineMode.. most of the work is done in this class,
38 * with some specific things delegated to the children.. Template
39 * method pattern, right ? :)
41 class TextLabelModeBase
42 : public KigMode
44 class Private;
45 Private* d;
47 public:
48 // below is the interface towards TextLabelWizard...
49 void cancelPressed();
50 void finishPressed();
51 void enterTextPageEntered();
52 void selectArgumentsPageEntered();
53 void labelTextChanged();
54 void linkClicked( int );
55 void redrawScreen( KigWidget* w );
57 protected:
58 typedef std::vector<ObjectCalcer::shared_ptr> argvect;
59 // the protected interface for subclasses
60 TextLabelModeBase( KigPart& d );
61 ~TextLabelModeBase();
63 void setCoordinate( const Coordinate& coord );
64 void setText( const QString& s );
65 void setLocationParent( ObjectCalcer* o );
66 // objects you pass here, should be newly created property objects,
67 // that have no children..
68 void setPropertyObjects( const argvect& props );
69 void setFrame( bool f );
71 virtual void finish( const Coordinate& s, const QString& s,
72 const argvect& props, bool needframe,
73 ObjectCalcer* locationparent ) = 0;
75 private:
76 // the KigMode interface..
77 void leftClicked( QMouseEvent*, KigWidget* );
78 void leftReleased( QMouseEvent*, KigWidget* );
80 void mouseMoved( QMouseEvent*, KigWidget* );
82 void enableActions();
84 void cancelConstruction();
86 void killMode();
88 private:
89 //internal
90 // What Are We Doing...
91 // the diff between SelectingArgs and ReallySelectingArgs is that
92 // the latter means the user is selecting an arg in the kig window,
93 // whereas the first only means that he's looking at the second
94 // page of the wizard...
95 typedef enum { SelectingLocation, RequestingText, SelectingArgs, ReallySelectingArgs } wawdtype;
97 void updateWiz();
98 void updateLinksLabel();
101 class TextLabelConstructionMode
102 : public TextLabelModeBase
104 public:
105 TextLabelConstructionMode( KigPart& d );
106 ~TextLabelConstructionMode();
108 void finish( const Coordinate& coord, const QString& s,
109 const argvect& props, bool needframe,
110 ObjectCalcer* locationparent );
113 class TextLabelRedefineMode
114 : public TextLabelModeBase
116 ObjectTypeCalcer* mlabel;
117 void finish( const Coordinate& coord, const QString& s,
118 const argvect& props, bool needframe,
119 ObjectCalcer* locationparent );
120 public:
121 TextLabelRedefineMode( KigPart& d, ObjectTypeCalcer* label );
122 ~TextLabelRedefineMode();
125 #endif