CMS 3D CMS Logo

IgQtObjectMenuService.cc

Go to the documentation of this file.
00001 //<<<<<< INCLUDES                                                       >>>>>>
00002 
00003 #include "Iguana/Studio/interface/IgQtObjectMenuService.h"
00004 #include "Iguana/Studio/interface/IgQtObjectMenuMessage.h"
00005 #include "Iguana/Studio/interface/IgQtObjectMenu.h"
00006 #include <classlib/utils/DebugAids.h>
00007 #include <qpopupmenu.h>
00008 
00009 //<<<<<< PRIVATE DEFINES                                                >>>>>>
00010 //<<<<<< PRIVATE CONSTANTS                                              >>>>>>
00011 //<<<<<< PRIVATE TYPES                                                  >>>>>>
00012 //<<<<<< PRIVATE VARIABLE DEFINITIONS                                   >>>>>>
00013 //<<<<<< PUBLIC VARIABLE DEFINITIONS                                    >>>>>>
00014 //<<<<<< CLASS STRUCTURE INITIALIZATION                                 >>>>>>
00015 
00016 IG_DEFINE_STATE_ELEMENT (IgQtObjectMenuService, "Services/Qt/Object Menu");
00017 
00018 //<<<<<< PRIVATE FUNCTION DEFINITIONS                                   >>>>>>
00019 //<<<<<< PUBLIC FUNCTION DEFINITIONS                                    >>>>>>
00020 //<<<<<< MEMBER FUNCTION DEFINITIONS                                    >>>>>>
00021 
00022 IgQtObjectMenuService::IgQtObjectMenuService (IgState *state)
00023     : m_state (state),
00024       m_menu (new QPopupMenu),
00025       m_proxy (0)
00026 {
00027     ASSERT (m_state);
00028     m_state->put (s_key, this);
00029     m_menu->setCaption ("Object Operations");
00030     m_proxy = new IgQtObjectMenu (m_menu);
00031 }
00032 
00033 IgQtObjectMenuService::~IgQtObjectMenuService (void)
00034 {
00035     ASSERT (m_state);
00036     ASSERT (m_menu);
00037     ASSERT (m_proxy);
00038 
00039     m_state->detach (s_key);
00040     delete m_proxy;
00041     delete m_menu;
00042 }
00043 
00044 IgQtObjectMenu *
00045 IgQtObjectMenuService::menu (void) const
00046 {
00047     ASSERT (m_state);
00048     ASSERT (m_menu);
00049     ASSERT (m_proxy);
00050     return m_proxy;
00051 }
00052 
00053 QPopupMenu *
00054 IgQtObjectMenuService::realMenu (void) const
00055 {
00056     ASSERT (m_state);
00057     ASSERT (m_menu);
00058     ASSERT (m_proxy);
00059     return m_menu;
00060 }
00061 
00062 QPopupMenu *
00063 IgQtObjectMenuService::request (IgRepresentable *object)
00064 {
00065     ASSERT (object);
00066     ASSERT (m_state);
00067     ASSERT (m_menu);
00068     ASSERT (m_proxy);
00069 
00070     // Update the master and real menus.
00071     broadcast (IgQtObjectMenuMessage (m_proxy, object));
00072     return m_menu;
00073 }
00074 
00075 void
00076 IgQtObjectMenuService::postUpdate (IgRepresentable *object)
00077 {
00078     // FIXME: Do this only if the menu is torn off.  I don't know of a
00079     // way to find out whether that's the case, so we always do it.
00080     ASSERT (object);
00081     ASSERT (m_state);
00082     ASSERT (m_menu);
00083     ASSERT (m_proxy);
00084 
00085     broadcast (IgQtObjectMenuMessage (m_proxy, object));
00086 }

Generated on Tue Jun 9 17:38:49 2009 for CMSSW by  doxygen 1.5.4