|
From: Darius S. <dst...@us...> - 2001-07-25 12:52:10
|
Update of /cvsroot/kuml/kuml/kuml_gui/src/ige/common/views
In directory usw-pr-cvs1:/tmp/cvs-serv2470
Added Files:
TextLineView.h TextLineView.cpp ChainedLineView.h
ChainedLineView.cpp CompositeView.h CompositeView.cpp
Log Message:
Added file
--- NEW FILE ---
/***************************************************************************
TextLineView.h - description
-------------------
begin : Wed Jun 25 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
email : sta...@in...
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef TEXTLINEVIEW_H
#define TEXTLINEVIEW_H
#include "RectangleView.h"
class TextLineView : public RectangleView {
public:
virtual ~TextLineView();
TextLineView(Viewer * viewer = 0, View * parent = 0);
protected:
virtual void paintContents(QPainter * painter);
};
#endif //TEXTLINEVIEW_H
--- NEW FILE ---
/***************************************************************************
TextLineView.cpp - description
-------------------
begin : Wed Jun 25 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
email : sta...@in...
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#include "TextLineView.h"
#include <qpainter.h>
void TextLineView::paintContents(QPainter * painter) {
painter->drawRect(bounds());
}
TextLineView::~TextLineView(){
}
TextLineView::TextLineView(Viewer * viewer, View * parent) : RectangleView(viewer, parent) {
}
--- NEW FILE ---
/***************************************************************************
ChainedLineView.h - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
email : sta...@in...
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef CHAINEDLINEVIEW_H
#define CHAINEDLINEVIEW_H
#include "LineView.h"
class ViewManipulator;
class ChainedLineView : public LineView {
public:
virtual QPoint& getStartPoint();
virtual void setStartPoint(const QPoint& startPoint);
virtual QPoint& getEndPoint();
virtual void setEndPoint(const QPoint& endPoint);
virtual ViewManipulator* createManipulator();
int getSegments();
void setSegments(int segments);
void addSegment();
void removeSegment(int at);
virtual ~ChainedLineView();
ChainedLineView(Viewer * viewer = 0, View * parent = 0);
private:
int segmentsCount;
};
#endif //CHAINEDLINEVIEW_H
--- NEW FILE ---
/***************************************************************************
ChainedLineView.cpp - description
-------------------
begin : Tue July 24 2001
copyright : (C) 2001 by the kUML Team
author : Darius Stachow
email : sta...@in...
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#include "ChainedLineView.h"
#include "SimpleLineView.h"
#include "ige/common/manipulators/ChainedLineViewResizer.h"
void ChainedLineView::removeSegment(int at){}
void ChainedLineView::addSegment(){}
void ChainedLineView::setSegments(int segments){
this->segmentsCount = segments;
}
int ChainedLineView::getSegments(){
return segmentsCount;
}
ViewManipulator* ChainedLineView::createManipulator() {
// qDebug("RectangleView::createManipulator() executed");
manipulator = new ChainedLineViewResizer(this);
return manipulator;
}
void ChainedLineView::setEndPoint(const QPoint& endPoint){
// this->endPoint = endPoint;
}
QPoint& ChainedLineView::getEndPoint(){
// return endPoint;
}
void ChainedLineView::setStartPoint(const QPoint& startPoint){
// this->startPoint = startPoint;
}
QPoint& ChainedLineView::getStartPoint(){
// return startPoint;
}
ChainedLineView::~ChainedLineView(){}
ChainedLineView::ChainedLineView(Viewer * viewer, View * parent) : LineView(viewer, parent) {
SimpleLineView *view = 0;
view = new SimpleLineView(viewer, this);
view->setStartPoint(QPoint(10,10));
view->setEndPoint(QPoint(100,100));
addChild(view);
view = new SimpleLineView(viewer, this);
view->setStartPoint(QPoint(100,100));
view->setEndPoint(QPoint(220,80));
addChild(view);
view = new SimpleLineView(viewer, this);
view->setStartPoint(QPoint(220,80));
view->setEndPoint(QPoint(420,420));
addChild(view);
}
--- NEW FILE ---
/* Generated by Together */
#ifndef COMPOSITEVIEW_H
#define COMPOSITEVIEW_H
#include "AbstractView.h"
#include "View.h"
#include <vector.h>
#include "Layoutable.h"
class ViewLayouter;
class CompositeView : public AbstractView , public Layoutable{
public:
CompositeView(Viewer * viewer = 0, View * parent = 0);
virtual ~CompositeView();
/**
* Returns the bounding rectangle
*/
virtual QRect bounds();
/**
* Returns true if the view collides with the given mouse position
*/
virtual bool intersects(const QPoint &p);
/**
* Remove sub view
*/
virtual void removeChild(int i);
/**
* Add sub view
*/
virtual void addChild(View * g);
/**
* Will be called when the view has been changed and needs to resize and repaint
*/
virtual void changed();
/**
* Moves the object by a delta
*/
virtual void move(const QPoint& delta);
virtual View* getChild(int at);
virtual int getChildCount();
virtual void layout();
virtual ViewLayouter * getLayouter();
virtual void setLayouter(ViewLayouter* l);
protected:
/**
* This operation will be called by paint() after the paint attributes has
* been set. Usually you can implement this operation instead of paint() if
* want to have initialized paint attributes.
*/
virtual void paintContents(QPainter* painter);
public:
private:
/** @link aggregation
* @clientCardinality 1
* @supplierCardinality 0..**/
vector < View * > childs;
};
#endif //COMPOSITEVIEW_H
--- NEW FILE ---
/* Generated by Together */
#include "CompositeView.h"
void CompositeView::setLayouter(ViewLayouter* l){
}
ViewLayouter * CompositeView::getLayouter(){
}
class View;
int CompositeView::getChildCount(){
return childs.size();
}
View* CompositeView::getChild(int at){
if(childs.empty()) {
return 0;
}
// Check for out of range
if(at > childs.size() - 1)
return 0;
return childs[at];
}
void CompositeView::paintContents(QPainter* painter){
if(childs.empty()) {
return;
}
vector<View*>::iterator iter = childs.begin();
while( iter != childs.end()) {
(*iter)->paint(painter);
++iter;
}
}
CompositeView::~CompositeView(){
}
CompositeView::CompositeView(Viewer * viewer, View * parent) : AbstractView(viewer, parent) {
}
void CompositeView::move(const QPoint& delta){
if(childs.empty()) {
return;
}
vector<View*>::iterator iter = childs.begin();
while( iter != childs.end()) {
(*iter)->move(delta);
++iter;
}
}
void CompositeView::changed(){
if(childs.empty()) {
return;
}
vector<View*>::iterator iter = childs.begin();
while( iter != childs.end()) {
(*iter)->changed();
++iter;
}
// DefaultLayouter::getInstance()->layoutSubViews(this);
}
void CompositeView::addChild(View * g){
CHECK_PTR(g);
childs.insert(childs.end(), g);
}
void CompositeView::removeChild(int i){
if(childs.empty()) {
qDebug("CompositeView::removeChild(): no childs to remove");
return;
}
childs.erase(childs.begin() + i);
}
bool CompositeView::intersects(const QPoint &p){
if(childs.empty()) {
return false;
}
vector<View*>::iterator iter = childs.begin();
while( iter != childs.end()) {
if( (*iter)->intersects(p) ) {
return true;
}
++iter;
}
return false;
}
QRect CompositeView::bounds(){
QRect boundingArea;
if(childs.empty()) {
return boundingArea;
}
vector<View*>::iterator iter = childs.begin();
while( iter != childs.end()) {
boundingArea = boundingArea.unite((*iter)->bounds());
++iter;
}
return boundingArea;
}
|