IvfPopupMenu.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 
00025 #ifndef _CIvfPopupMenu_h_
00026 #define _CIvfPopupMenu_h_
00027 
00028 #include <ivf/ivfconfig.h>
00029 #include <ivfdef/IvfDef.h>
00030 
00031 #include <FL/Fl.H>
00032 #include <FL/Fl_Menu_Button.H>
00033 
00034 #include <map>
00035 
00036 class IVFUI_API CIvfPopupMenu {
00037 public:
00038         enum TMenuType {
00039                 MT_NORMAL,
00040                 MT_INACTIVE,
00041                 MT_TOGGLE,
00042                 MT_RADIO,
00043                 MT_INVISIBLE
00044         };
00045 
00046         enum TActivationButton {
00047                 AB_LEFT,
00048                 AB_RIGHT,
00049                 AB_MIDDLE
00050         };
00051 private:
00052         Fl_Menu_Button* m_menu;
00053         std::map<void*,int> m_menuMap;
00054         int m_menuSize;
00055         bool m_menuEnabled;
00056         TActivationButton m_activationButton;
00057 public:
00058         TActivationButton getActivationButton();
00059         CIvfPopupMenu();
00060         virtual ~CIvfPopupMenu();
00061 
00062         void popup();
00063         void addMenuItem(const char* label, const char* shortcut, TMenuType type, int id);
00064         void enablePopupMenu();
00065         void disablePopupMenu();
00066         bool isPopupMenuEnabled();
00067         void setActivationButton(TActivationButton activation);
00068 
00069         int getMenuId(const Fl_Menu_Item* menuItem);
00070         Fl_Menu_Button* getMenu();
00071         void setParent(Fl_Group* group);
00072 
00073         virtual void onMenu(int id, TMenuType type);
00074 
00075 };
00076 
00077 #endif 

Generated on Fri Sep 1 15:36:47 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO