Radu Ursu 08-01-2002

replaced >> operator for attaching tools with the public member function
void attach(Qt_widget_tool& tool);
This commit is contained in:
Radu Ursu 2002-01-08 17:11:08 +00:00
parent 2ba2445ec5
commit debc84bee9
6 changed files with 17 additions and 14 deletions

View File

@ -91,9 +91,7 @@ namespace CGAL {
{
if (but[1]->isOn())
{
if(is_active)
but[activebutton]->toggle();
*widget >> getsimplebut;
widget->attach(getsimplebut);
activebutton = 1;
is_active = true;
} else {

View File

@ -106,7 +106,7 @@ namespace CGAL {
{
if (but[2]->isOn())
{
*widget >> linebut;
widget->attach(linebut);
activebutton = 2;
is_active = true;
}
@ -120,7 +120,7 @@ namespace CGAL {
{
if (but[1]->isOn())
{
*widget >> pointbut;
widget->attach(pointbut);
activebutton = 1;
is_active = true;
}
@ -143,7 +143,7 @@ namespace CGAL {
{
widget->detach_current_tool();
movepointbut.set_Delaunay(dt);
*widget >> movepointbut;
widget->attach(movepointbut);
activebutton = 3;
is_active = true;
}

View File

@ -77,6 +77,13 @@ widget to be c.}
widget to s. PointStyle is a enumeration declared in Qt\_widget.}
\ccMethod{void setRasterOp(RasterOp r);}{Set the current raster operation.}
%tools
%\ccHeading{Tools}
\ccMethod{void attach(Qt_widget_tool& tool);}{Attach a tool to the widget. Only
one tool can be attached at a moment of time.}
\ccMethod{bool has_tool() const;}{Returns true if it is a tool attached.}
\ccMethod{void detach_current_tool();}{Detach the current tool from the widget.}
%scenes
%\ccHeading{Scenes}
\ccMethod{void add_scene(Qt_scene* s);}{Add the scene s in the list of scenes.

View File

@ -76,7 +76,6 @@ public:
void lock() { ++Locked; };
void unlock() { if (Locked>0) --Locked; do_paint(); };
void do_paint() { if (Locked==0) repaint( FALSE ); };
void show_scene(Qt_scene* s);
@ -154,8 +153,9 @@ public:
// tool system
// ~~~~~~~~~~~
void attach(Qt_widget_tool& tool);
inline bool has_tool() const { return _has_tool; };
void detach_current_tool();
void detach_current_tool();
Qt_widget& operator<<(Qt_widget_tool* tool);
Qt_widget& operator>>(Qt_widget_tool &tool);

View File

@ -354,8 +354,7 @@ Qt_widget& operator<<(Qt_widget& w, const Bbox_2& r)
*Ursu Radu coding ....
*
*********************************************/
Qt_widget& Qt_widget::operator>>(Qt_widget_tool &tool)
{
void Qt_widget::attach(Qt_widget_tool& tool) {
if (has_tool()) {
current_tool->detach();
emit(detached_tool());
@ -363,7 +362,6 @@ Qt_widget& Qt_widget::operator>>(Qt_widget_tool &tool)
current_tool=&tool;
_has_tool=true;
current_tool->attach(this);
return *this;
}
void Qt_widget::detach_current_tool()
{

View File

@ -119,7 +119,7 @@ namespace CGAL {
{
if (but[3]->isOn())
{
*widget >> zoombut;
widget->attach(zoombut);
activebutton = 3;
is_active = true;
}
@ -134,7 +134,7 @@ namespace CGAL {
{
if (but[4]->isOn())
{
*widget >> zoomrectbut;
widget->attach(zoomrectbut);
activebutton = 4;
is_active = true;
}
@ -169,7 +169,7 @@ namespace CGAL {
if (but[5]->isOn())
{
widget->detach_current_tool();
*widget >> handtoolbut;
widget->attach(handtoolbut);
activebutton = 5;
is_active = true;
} else {