PieDock 1.6.0

src/Menu.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_Menu_
00015 #define _PieDock_Menu_
00016 
00017 #include "Application.h"
00018 #include "Settings.h"
00019 #include "Icon.h"
00020 #include "MenuItems.h"
00021 
00022 #include <string>
00023 
00024 namespace PieDock
00025 {
00031     class Menu
00032     {
00033         public:
00034             Menu( Application * );
00035             virtual ~Menu() {}
00036             inline void setWindowBelowCursor( Window w ) {
00037                 windowBelowCursor = w; }
00038             inline const Window &getWindowBelowCursor() const {
00039                 return windowBelowCursor; }
00040             inline MenuItem *getSelected() const {
00041                 return selected; }
00042             inline const std::string &getName() const {
00043                 return name; }
00044             virtual bool update( std::string, Window = 0 );
00045             virtual void draw( int, int ) {}
00046             virtual bool change( Settings::Action = Settings::Launch );
00047             virtual void execute( Settings::Action = Settings::Launch );
00048             virtual std::string getItemTitle() const;
00049 
00050         protected:
00051             inline Application *getApp() const { return app; }
00052             inline void setSelected( MenuItem *s ) {
00053                 selected = s; }
00054             inline MenuItems *getMenuItems() const {
00055                 return menuItems; }
00056             virtual int run( std::string ) const;
00057 
00058         private:
00059             Application *app;
00060             MenuItem *selected;
00061             MenuItems *menuItems;
00062             MenuItems openWindows;
00063             Window windowBelowCursor;
00064             std::string name;
00065     };
00066 }
00067 
00068 #endif