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
18 #ifndef KIG_MODE_LABEL_H
19 #define KIG_MODE_LABEL_H
23 #include "../objects/object_calcer.h"
27 class TextLabelWizard
;
31 class ObjectPropertyCalcer
;
32 class ObjectTypeCalcer
;
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
48 // below is the interface towards TextLabelWizard...
51 void enterTextPageEntered();
52 void selectArgumentsPageEntered();
53 void labelTextChanged();
54 void linkClicked( int );
55 void redrawScreen( KigWidget
* w
);
58 typedef std::vector
<ObjectCalcer::shared_ptr
> argvect
;
59 // the protected interface for subclasses
60 TextLabelModeBase( KigPart
& d
);
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;
76 // the KigMode interface..
77 void leftClicked( QMouseEvent
*, KigWidget
* );
78 void leftReleased( QMouseEvent
*, KigWidget
* );
80 void mouseMoved( QMouseEvent
*, KigWidget
* );
84 void cancelConstruction();
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
;
98 void updateLinksLabel();
101 class TextLabelConstructionMode
102 : public TextLabelModeBase
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
);
121 TextLabelRedefineMode( KigPart
& d
, ObjectTypeCalcer
* label
);
122 ~TextLabelRedefineMode();