home *** CD-ROM | disk | FTP | other *** search
- /******************************************************************************
- **
- ** C++ Class Library for the Amiga© system software.
- **
- ** Copyright (C) 1994 by Armin Vogt ** EMail: armin@uni-paderborn.de
- ** All Rights Reserved.
- **
- ** $Source: apphome:APlusPlus/RCS/libsource/GraphicObject.cxx,v $
- ** $Revision: 1.3 $
- ** $Date: 1994/04/23 21:01:09 $
- ** $Author: Armin_Vogt $
- **
- ******************************************************************************/
-
-
- #include <APlusPlus/graphics/GraphicObject.h>
-
-
- volatile static char rcs_id[] = "$Id: GraphicObject.cxx,v 1.3 1994/04/23 21:01:09 Armin_Vogt Exp Armin_Vogt $";
-
-
- GraphicObject::GraphicObject(GraphicObject *owner,AttrList& attrs)
- : IntuiObject(owner,attrs)
- {
- if (Ok())
- {
- setIOType(GRAPHICOBJECT);
- GBorder *gbObj = (GBorder*)intuiAttrs().getTagData(GOB_Border);
- if (gbObj) gbObj->makeBorder(this);
- }
- }
-
- GraphicObject::~GraphicObject()
- {
-
- }
-
-
- ULONG GraphicObject::setAttributes(AttrList& attrs)
- /* only propagates the update attrs to the base class.
- */
- {
- GBorder *gbObj = (GBorder*)attrs.getTagData(GOB_Border);
- if (gbObj) gbObj->makeBorder(this);
-
- return IntuiObject::setAttributes(attrs);
- }
-
- ULONG GraphicObject::getAttribute(Tag tag,ULONG& dataStore)
- {
- return IntuiObject::getAttribute(tag,dataStore);
- }
-
- APTR GraphicObject::redrawSelf(GWindow *homeWindow,ULONG& returnType)
- {
- GBorder *gbObj = (GBorder*)intuiAttrs().getTagData(GOB_Border);
- if (gbObj) gbObj->drawBorder(this,homeWindow);
-
- // notifyFlush(AttrList()); // flush all attributes into the notification stream
- returnType = 0L;
- return NULL;
- }
-
- void GraphicObject::adjustChilds()
- /* Adjust graphical dimensions of the GraphicObject childs of 'this' GraphicObject
- according to the GOB_ tags defined in GraphicObject.h, depending on the dimensions
- of 'this'. The adjustment of each child will cause adjustments of all its GraphicObject
- childs down the IntuiObject tree.
- 'adjustChilds' needs to be invoked on every window since each invokation only
- regards non-window childs.
- */
- {
- GraphicObject *relative = NULL;
- GraphicObject *pred = NULL;
-
- FOREACHOF(GraphicObject,this)
- {
- if (node->isKindOf(IOBASE_WINDOW)) continue; // leave out child windows
-
- node->setRect(0,0,0,0);
-
- AttrIterator next(node->intuiAttrs());
- while (next())
- {
- LONG data = (LONG)next.data();
- ULONG tagID = next.tag() - GOB_Spec_Dummy;
-
- if (tagID < 16)
- {
- relative = tagID&gob_relative ? (pred==NULL?this:pred) : this;
-
- _dout("relative has ("<<relative->iLeft()<<"),("<<relative->iTop()
- <<"),("<<relative->iRight()<<"),("<<relative->iBottom()<<")\n");
- WHVAL distance;
-
- if (tagID & gob_orient)
- {
- distance = ((tagID & gob_reledge)?
- ((tagID & gob_relative)?relative->bottom():relative->iBottom())
- :
- ((tagID & gob_relative)?relative->top():relative->iTop())
- ) + GOB_Absolute(iHeight(),data);
- if (tagID & gob_edge)
- node->maxY(distance);
- else
- node->minY(distance);
- }
- else
- {
- distance = ((tagID & gob_reledge) ?
- ((tagID & gob_relative)?relative->right():relative->iRight())
- :
- ((tagID & gob_relative)?relative->left():relative->iLeft())
- ) + GOB_Absolute(iWidth(),data);
- if (tagID & gob_edge)
- node->maxX(distance);
- else
- node->minX(distance);
- }
- }
- else switch(next.tag()) // other GraphicObject tags
- {
-
- default: break;
- }
- }
- pred = node;
- _dout("adjustChild to: "<<node->left()<<"("<<node->iLeft()<<"),"<<node->top()<<"("<<node->iTop()<<"),"
- <<node->right()<<"("<<node->iRight()<<"),"<<node->bottom()<<"("<<node->iBottom()<<")\n");
- node->adjustChilds();
- }
- }
-