You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdesdk/umbrello/umbrello/forkjoinwidget.h

104 lines
3.0 KiB

/***************************************************************************
* *
* 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. *
* *
* copyright (C) 2005-2006 *
* Umbrello UML Modeller Authors <uml-devel@uml.sf.net> *
***************************************************************************/
#ifndef FORKJOINWIDGET_H
#define FORKJOINWIDGET_H
//qt includes
#include <tqpainter.h>
//app includes
#include "boxwidget.h"
// fwd decl.
class UMLView;
/**
* @short Displays a fork/join plate in a state diagram.
* @author Oliver Kellogg <okellogg@users.sourceforge.net>
* @see UMLWidget
* Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org
*/
class ForkJoinWidget : public BoxWidget {
public:
/**
* Constructs a ForkJoinWidget.
*
* @param view The parent to this widget.
* @param drawVertical Whether to draw the plate horizontally or vertically.
* @param id The ID to assign (-1 will prompt a new ID.)
*/
explicit ForkJoinWidget(UMLView * view, bool drawVertical = false, Uml::IDType id = Uml::id_None);
/**
* destructor
*/
virtual ~ForkJoinWidget();
/**
* Set whether to draw the plate vertically.
*/
void setDrawVertical(bool to);
/**
* Get whether to draw the plate vertically.
*/
bool getDrawVertical() const;
/**
* Overrides the function from UMLWidget.
*
* @param sel The command to be executed.
*/
void slotMenuSelection(int sel);
/**
* Draws a slim solid black rectangle.
*/
void draw(TQPainter & p, int offsetX, int offsetY);
/**
* Saves the widget to the "forkjoinwidget" XMI element.
*/
void saveToXMI(TQDomDocument& qDoc, TQDomElement& qElement);
/**
* Loads the widget from the "forkjoinwidget" XMI element.
*/
bool loadFromXMI(TQDomElement & qElement);
protected:
/**
* Reimplement method from UMLWidget to suppress the resize corner.
* Although the ForkJoinWidget supports resizing, we suppress the
* resize corner because it is too large for this very slim widget.
*/
void drawSelected(TQPainter * p, int offsetX, int offsetY);
/**
* Overrides the function from UMLWidget.
*/
TQSize calculateSize();
/**
* Reimplement method from UMLWidget.
*/
void constrain(int& width, int& height);
private:
/**
* Initializes key variables for the class.
*/
void init();
bool m_drawVertical; ///< whether to draw the plate horizontally or vertically
};
#endif