diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2 (patch) | |
tree | d3bb9f5d25a2dc09ca81adecf39621d871534297 /kig/modes/label.h | |
download | tdeedu-ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2.tar.gz tdeedu-ce599e4f9f94b4eb00c1b5edb85bce5431ab3df2.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeedu@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kig/modes/label.h')
-rw-r--r-- | kig/modes/label.h | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/kig/modes/label.h b/kig/modes/label.h new file mode 100644 index 00000000..4a3d09f7 --- /dev/null +++ b/kig/modes/label.h @@ -0,0 +1,129 @@ +// Copyright (C) 2002 Dominique Devriese <devriese@kde.org> + +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +// 02110-1301, USA. + +#ifndef KIG_MODE_LABEL_H +#define KIG_MODE_LABEL_H + +#include "mode.h" + +#include "../objects/object_calcer.h" + +#include <vector> + +class TextLabelWizard; +class NormalMode; +class Coordinate; +class QString; +class ObjectPropertyCalcer; +class ObjectTypeCalcer; +class ObjectCalcer; + +/** + * this is the base class for TextLabelConstructionMode and + * TextLabelRedefineMode.. most of the work is done in this class, + * with some specific things delegated to the children.. Template + * method pattern, right ? :) + */ +class TextLabelModeBase + : public KigMode +{ + class Private; + Private* d; + +public: + // below is the interface towards TextLabelWizard... + void cancelPressed(); + void finishPressed(); + void enterTextPageEntered(); + void selectArgumentsPageEntered(); + void labelTextChanged(); + void linkClicked( int ); + void redrawScreen( KigWidget* w ); + +protected: + typedef std::vector<ObjectCalcer::shared_ptr> argvect; + // the protected interface for subclasses + TextLabelModeBase( KigPart& d ); + ~TextLabelModeBase(); + + void setCoordinate( const Coordinate& coord ); + void setText( const QString& s ); + void setLocationParent( ObjectCalcer* o ); + /** + * objects you pass here, should be newly created property objects, + * that have no children.. + */ + void setPropertyObjects( const argvect& props ); + void setFrame( bool f ); + + virtual void finish( const Coordinate& c, const QString& s, + const argvect& props, bool needframe, + ObjectCalcer* locationparent ) = 0; + +private: + // the KigMode interface.. + void leftClicked( QMouseEvent*, KigWidget* ); + void leftReleased( QMouseEvent*, KigWidget* ); + + void mouseMoved( QMouseEvent*, KigWidget* ); + + void enableActions(); + + void cancelConstruction(); + + void killMode(); + +private: + /** + * \internal + * What Are We Doing... + * the diff between SelectingArgs and ReallySelectingArgs is that + * the latter means the user is selecting an arg in the kig window, + * whereas the first only means that he's looking at the second + * page of the wizard... + */ + typedef enum { SelectingLocation, RequestingText, SelectingArgs, ReallySelectingArgs } wawdtype; + + void updateWiz(); + void updateLinksLabel(); +}; + +class TextLabelConstructionMode + : public TextLabelModeBase +{ +public: + TextLabelConstructionMode( KigPart& d ); + ~TextLabelConstructionMode(); + + void finish( const Coordinate& coord, const QString& s, + const argvect& props, bool needframe, + ObjectCalcer* locationparent ); +}; + +class TextLabelRedefineMode + : public TextLabelModeBase +{ + ObjectTypeCalcer* mlabel; + void finish( const Coordinate& coord, const QString& s, + const argvect& props, bool needframe, + ObjectCalcer* locationparent ); +public: + TextLabelRedefineMode( KigPart& d, ObjectTypeCalcer* label ); + ~TextLabelRedefineMode(); +}; + +#endif |