PieDock 1.6.0

src/ActiveIndicator.h

00001 /*
00002  *   O         ,-
00003  *  ° o    . -´  '     ,-
00004  *   °  .´        ` . ´,´
00005  *     ( °   ))     . (
00006  *      `-;_    . -´ `.`.
00007  *          `._'       ´
00008  *
00009  * Copyright (c) 2007-2010 Markus Fisch <mf@markusfisch.de>
00010  *
00011  * Licensed under the MIT license:
00012  * http://www.opensource.org/licenses/mit-license.php
00013  */
00014 #ifndef _PieDock_ActiveIndicator_
00015 #define _PieDock_ActiveIndicator_
00016 
00017 #include "ArgbSurfaceSizeMap.h"
00018 
00019 namespace PieDock
00020 {
00026     class ActiveIndicator
00027     {
00028         public:
00029             ActiveIndicator() : sizeMap( 0 ) { reset(); }
00030             virtual ~ActiveIndicator() { clear(); }
00031             inline ArgbSurfaceSizeMap *getSizeMap() const {
00032                 return sizeMap; }
00033             inline const int getX( int s, int i ) const
00034             {
00035                 switch( xAlign )
00036                 {
00037                     default:
00038                     case Left:
00039                         return 0;
00040                     case Center:
00041                         return (i-s)>>1;
00042                     case Right:
00043                         return i-s;
00044                 }
00045             }
00046             inline const int getY( int s, int i ) const
00047             {
00048                 switch( yAlign )
00049                 {
00050                     default:
00051                     case Top:
00052                         return 0;
00053                     case Center:
00054                         return (i-s)>>1;
00055                     case Bottom:
00056                         return i-s;
00057                 }
00058             }
00059             virtual void load( std::string );
00060             virtual void parseX( std::string );
00061             virtual void parseY( std::string );
00062             virtual void reset();
00063 
00064         private:
00065             enum Alignment
00066             {
00067                 Left,
00068                 Right,
00069                 Top,
00070                 Bottom,
00071                 Center
00072             };
00073 
00074             ArgbSurfaceSizeMap *sizeMap;
00075             Alignment xAlign;
00076             Alignment yAlign;
00077 
00078             void clear();
00079     };
00080 }
00081 
00082 #endif