|
From: andrew7 <bd...@us...> - 2006-11-30 00:38:33
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/aspects In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv19377/include/smartwin/aspects Modified Files: AspectSizable.h Log Message: Update doc to reflect change in API Index: AspectSizable.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/aspects/AspectSizable.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- AspectSizable.h 10 Sep 2006 11:38:15 -0000 1.25 +++ AspectSizable.h 30 Nov 2006 00:38:30 -0000 1.26 @@ -222,6 +222,10 @@ * The pos member of the Rectangle is the position and the size member is the * size. <br> * So a call to this function will (probably) also MOVE your Widget too. + * + * For a top-level window, the position and dimensions are relative to the + * upper-left corner of the screen. For a child window, they are relative + * to the upper-left corner of the parent window's client area. */ void setBounds( const Rectangle & rect, bool updateWindow = true ); @@ -317,12 +321,15 @@ */ Point getSize() const; - /// Returns the position of the window. - /** Note that this is in screen coordinates meaning the position returned is - * relative to the upper left corner of the desktop screen. - */ + /// Returns the position of the window relative to the parent window. + /** Note that this is in client coordinates. + */ Point getPosition() const; + /// Returns the screen position of the window. + Point getScreenPosition() const; + + /// Returns the size of the client area of the window. /** This differs from getSize because it disregards the border and headers, this * function only returns the client area of the Widget meaning the area which it @@ -542,6 +549,17 @@ return Point( rc.pos.x, rc.pos.y ); } + +template< class EventHandlerClass, class WidgetType, class MessageMapType > +Point AspectSizable< EventHandlerClass, WidgetType, MessageMapType >::getScreenPosition() const +{ + RECT rc; + ::GetWindowRect( const_cast < WidgetType * >( static_cast< const WidgetType * >( this ) )->handle(), & rc ); + return Point( rc.left, rc.top ); +} + + + template< class EventHandlerClass, class WidgetType, class MessageMapType > Point AspectSizable< EventHandlerClass, WidgetType, MessageMapType >::getClientAreaSize() const { |