CMS 3D CMS Logo

IgPage Class Reference

#include <Iguana/Studio/interface/IgPage.h>

Inheritance diagram for IgPage:

IgQHSplitterSite IgQSplitterSite IgQtSite IgSite

List of all members.

Public Slots

void showFullScreen (void)
void showMaximized (void)

Signals

void autoPrint (const QString &text)

Public Member Functions

IgQtSitebottomDockArea (void)
 IgPage (IgDocument *doc)
IgQtSiteleftDockArea (void)
void printViews (const QString &text)
void registerView (IgView *view, QWidget *selectableWidget)
IgQtSiterightDockArea (void)
IgQtSiteStackstackArea (void)
virtual IgStatestate (void) const
IgQtSiteStackworkspace (void)

Static Public Attributes

static const int MENU_ID_FILE_NEW = 150
static const int MENU_ID_WINDOW = 5000
static const int MENU_ID_WINDOW_CASCADE = 5002
static const int MENU_ID_WINDOW_FULLSCREEN = 5005
static const int MENU_ID_WINDOW_LIST_OFFSET = 6000
static const int MENU_ID_WINDOW_MAXIMIZE = 5004
static const int MENU_ID_WINDOW_SEP = 5003
static const int MENU_ID_WINDOW_TILE = 5001

Private Attributes

IgQtSitem_bottomDockArea
IgQtSitem_centralSplitter
IgDocumentm_document
QGridLayout * m_layout
IgQtSitem_leftDockArea
int m_numRegisteredWindows
IgQtSitem_rightDockArea
IgQtSiteStackm_stackArea
std::map< QWidget *, IgView * > m_views
IgQtSiteStackm_workspace


Detailed Description

Definition at line 24 of file IgPage.h.


Constructor & Destructor Documentation

IgPage::IgPage ( IgDocument doc  ) 

Definition at line 47 of file IgPage.cc.

References a, IgDocument::addPage(), ASSERT, IgPluginFactory< I >::begin(), HLT_VtxMuL3::connect, IgPluginFactory< I >::end(), DBSPlugin::get(), IgViewDB::get(), i, IgQtAppMenuService::index(), m_views, m_workspace, IgQtAppMenuService::MENU_ID_FILE, MENU_ID_FILE_NEW, MENU_ID_WINDOW, MENU_ID_WINDOW_CASCADE, MENU_ID_WINDOW_FULLSCREEN, MENU_ID_WINDOW_MAXIMIZE, MENU_ID_WINDOW_TILE, IgQtAppMenuService::menuBar(), IgQtSite::selfFrom(), parseConfig::service, showFullScreen(), showMaximized(), state(), IgDocument::state(), and IgQtAppMenuService::subMenu().

00048     : IgQHSplitterSite (doc->state (), doc->window ()),
00049       m_document (doc),
00050       m_leftDockArea (new IgQDockAreaSite (doc->state (), this)),
00051       m_stackArea (new IgQWidgetStackSite (doc->state (), new IgQDockWindowSite (doc->state (), m_leftDockArea))),
00052       m_centralSplitter (new IgQVSplitterSite (doc->state (), this)),
00053       m_workspace (createWorkspace (doc->state (), m_centralSplitter)),
00054       m_bottomDockArea (new IgQDockAreaSite (doc->state (), m_centralSplitter)),
00055       m_rightDockArea (new IgQDockAreaSite (doc->state (), this)),
00056       m_numRegisteredWindows (0)
00057 {
00058     // Construct a grid layout for holding contents
00059     // m_layout = new QGridLayout (self ());
00060     // m_layout->setAutoAdd (true);
00061 
00062     // FIXME: register in document
00063     // FIXME: read, write support
00064     ASSERT (doc);    
00065     doc->addPage (this);    
00066     
00067     IgQtAppMenuService *service = IgQtAppMenuService::get (doc->state ());
00068     
00069     QMenuBar *bar = service->menuBar ();    
00070     QAccel *a = new QAccel (IgQtSite::selfFrom (m_workspace));  // create accels for main Window
00071     a->connectItem (a->insertItem (Qt::Key_Escape),     // adds Esc accelerator
00072                     this,                               // connected to IgPage's
00073                     SLOT (showFullScreen ()));          // showFullScreen() slot
00074     
00075     // Here we populate the file menu with the "New" entry to allow user to
00076     // create new views of the different models
00077     QPopupMenu *fileMenu = service->subMenu (IgQtAppMenuService::MENU_ID_FILE);
00078     
00079     ASSERT (fileMenu);
00080     
00081     QPopupMenu *newViewMenu = new QPopupMenu (bar);
00082     newViewMenu->setCaption ("New");
00083     fileMenu->insertItem ("&New", newViewMenu, MENU_ID_FILE_NEW,
00084                           IgQtAppMenuService::index (fileMenu, MENU_ID_FILE_NEW));
00085     fileMenu->insertSeparator (IgQtAppMenuService::index (fileMenu, MENU_ID_FILE_NEW) + 1 );
00086     newViewMenu->insertTearOffHandle ();
00087     
00088     IgViewDB *viewDB = IgViewDB::get ();
00089     ASSERT (viewDB);
00090     
00091     // FIXME: sometimes, especially after rebuilding, viewDB is
00092     // empty...We need to find some better way to get notified when a
00093     // new IgView plugin is loaded.
00094     for (IgViewDB::Iterator i = viewDB->begin ();
00095          i != viewDB->end ();
00096          i++)
00097     {   
00098         IgViewCreator *viewCreator = new IgViewCreator (i, this);
00099         newViewMenu->insertItem ((*i)->name (), 
00100                                  viewCreator,
00101                                  SLOT (createView ()),
00102                                  0,
00103                                  IgQtAppMenuService::index (newViewMenu,
00104                                                             MENU_ID_FILE_NEW));
00105     }
00106     
00107     // Here we create the "Window" menu in which the user can decide
00108     // to hide/show some utility views (for example the python shell
00109     // should go here...)
00110     //
00111     // FIXME: how do we distinguish between different kind of Views?
00112     // By having two, separate, plugin categories?
00113     
00114     QPopupMenu *windowMenu = new QPopupMenu (bar);
00115     windowMenu->setCaption ("Window");
00116     bar->insertItem ("&Window", windowMenu, MENU_ID_WINDOW,
00117                      IgQtAppMenuService::index (bar, MENU_ID_WINDOW));
00118 
00119     windowMenu->insertTearOffHandle ();
00120     windowMenu->insertItem ("&Tile", 
00121                             IgQtSite::selfFrom (m_workspace),
00122                             SLOT (tile ()),
00123                             0,
00124                             MENU_ID_WINDOW_TILE,
00125                             IgQtAppMenuService::index (bar, MENU_ID_WINDOW));
00126     windowMenu->insertItem ("&Cascade", 
00127                             IgQtSite::selfFrom (m_workspace),
00128                             SLOT (cascade ()),
00129                             0,
00130                             MENU_ID_WINDOW_CASCADE,
00131                             IgQtAppMenuService::index (bar, MENU_ID_WINDOW));
00132 
00133     windowMenu->insertItem ("Show &Maximized", 
00134                             this,
00135                             SLOT (showMaximized ()),
00136                             0,
00137                             MENU_ID_WINDOW_MAXIMIZE,
00138                             IgQtAppMenuService::index (bar, MENU_ID_WINDOW));
00139 
00140     windowMenu->insertItem ("&Full screen", 
00141                             this,
00142                             SLOT (showFullScreen ()),
00143                             Qt::CTRL+Qt::Key_F,
00144                             MENU_ID_WINDOW_FULLSCREEN,
00145                             IgQtAppMenuService::index (bar, MENU_ID_WINDOW));
00146 
00147     windowMenu->insertSeparator ();
00148     // Get notified by window selection changes
00149     //    connect (IgQtSite::selfFrom (m_workspace), SIGNAL (windowActivated (QWidget *)),
00150     //       this, SLOT (windowActivated (QWidget *)));
00151     IgQtFocusManager *focusManager = new IgQtFocusManager (state (), &m_views);
00152     
00153     QObject::connect (IgQtSite::selfFrom (m_workspace),
00154                       SIGNAL (windowActivated (QWidget *)),
00155                       focusManager,
00156                       SLOT (windowActivated (QWidget *)));
00157     
00158     self ()->show ();
00159 }


Member Function Documentation

void IgPage::autoPrint ( const QString &  text  )  [signal]

Referenced by printViews().

IgQtSite * IgPage::bottomDockArea ( void   ) 

Definition at line 190 of file IgPage.cc.

References m_bottomDockArea.

Referenced by VisApplicationMain::setup(), and showFullScreen().

00191 {
00192     return m_bottomDockArea;
00193 }

IgQtSite * IgPage::leftDockArea ( void   ) 

Definition at line 178 of file IgPage.cc.

References m_leftDockArea.

Referenced by IgMDIView::IgMDIView(), and showFullScreen().

00179 {
00180     return m_leftDockArea;
00181 }

void IgPage::printViews ( const QString &  text  ) 

Definition at line 278 of file IgPage.cc.

References autoPrint().

Referenced by VisEventMenu::print().

00279 {
00280     emit autoPrint (text);    
00281 }

void IgPage::registerView ( IgView view,
QWidget *  selectableWidget 
)

Definition at line 202 of file IgPage.cc.

References ASSERT, DBSPlugin::get(), IgQtAppMenuService::index(), m_numRegisteredWindows, m_views, MENU_ID_WINDOW, MENU_ID_WINDOW_LIST_OFFSET, state(), IgQtAppMenuService::subMenu(), and IgView::title().

Referenced by Ig3DBaseWindow::watchBrowser().

00203 {
00204     ASSERT (m_views[selectableWidget] == 0);
00205     m_views[selectableWidget] = view;
00206     
00207     // FIXME: maybe we should also introduce different kind of views,
00208     // so that a view can have a title, without having to be
00209     // registered in the window menu.
00210     if (view->title () != "")
00211     {
00212         IgQtAppMenuService *ms = IgQtAppMenuService::get (state ());
00213     
00214         QPopupMenu *menu = ms->subMenu (MENU_ID_WINDOW);
00215         int itemID = MENU_ID_WINDOW_LIST_OFFSET + m_numRegisteredWindows++;
00216     
00217         menu->insertItem (view->title (), 
00218                           selectableWidget,
00219                           SLOT (show ()),
00220                           0,
00221                           itemID,
00222                           IgQtAppMenuService::index (menu,
00223                                                      MENU_ID_WINDOW_LIST_OFFSET));
00224         menu->connectItem (itemID, selectableWidget, SLOT (setFocus()));
00225     }
00226 }

IgQtSite * IgPage::rightDockArea ( void   ) 

Definition at line 184 of file IgPage.cc.

References m_rightDockArea.

Referenced by showFullScreen().

00185 {
00186     return m_rightDockArea;
00187 }

void IgPage::showFullScreen ( void   )  [slot]

Definition at line 249 of file IgPage.cc.

References ASSERT, bottomDockArea(), DBSPlugin::get(), leftDockArea(), m_document, MENU_ID_WINDOW_MAXIMIZE, rightDockArea(), IgQtSite::selfFrom(), and IgDocument::state().

Referenced by IgPage(), and VisApplicationMain::setup().

00250 {    
00251     QMenuBar *menu = IgQtAppMenuService::get (m_document->state ())->menuBar ();
00252     ASSERT (menu);
00253     QToolBar *toolBar = IgQtAppToolBarService::get (m_document->state ())->toolBar (3000, "General graphics ops");
00254     ASSERT (toolBar);
00255     QWidget *mainWindow = IgQtAppWindowService::get (m_document->state ())->mainWindow ();
00256     if (mainWindow->isFullScreen ())
00257     {
00258         menu->setItemEnabled (MENU_ID_WINDOW_MAXIMIZE, true);
00259         menu->show ();
00260         toolBar->show ();
00261         IgQtSite::selfFrom (leftDockArea ())->show ();
00262         IgQtSite::selfFrom (bottomDockArea ())->show ();
00263         mainWindow->showNormal ();
00264     } 
00265     else 
00266     { 
00267         menu->hide ();
00268         toolBar->hide ();
00269         IgQtSite::selfFrom (leftDockArea ())->hide ();
00270         IgQtSite::selfFrom (rightDockArea ())->hide ();
00271         IgQtSite::selfFrom (bottomDockArea ())->hide ();
00272         menu->setItemEnabled (MENU_ID_WINDOW_MAXIMIZE, false);
00273         mainWindow->showFullScreen ();
00274     }
00275 }

void IgPage::showMaximized ( void   )  [slot]

Definition at line 229 of file IgPage.cc.

References ASSERT, DBSPlugin::get(), m_document, MENU_ID_WINDOW_FULLSCREEN, MENU_ID_WINDOW_MAXIMIZE, and IgDocument::state().

Referenced by IgPage(), and VisApplicationMain::setup().

00230 {    
00231     QMenuBar *menu = IgQtAppMenuService::get (m_document->state ())->menuBar ();
00232     ASSERT (menu);
00233     QWidget *mainWindow = IgQtAppWindowService::get (m_document->state ())->mainWindow ();
00234     if (mainWindow->isMaximized ())
00235     {
00236         menu->changeItem (MENU_ID_WINDOW_MAXIMIZE, "Show &Maximized");
00237         menu->setItemEnabled (MENU_ID_WINDOW_FULLSCREEN, true);
00238         mainWindow->showNormal ();
00239     } 
00240     else 
00241     { 
00242         menu->changeItem (MENU_ID_WINDOW_MAXIMIZE, "Show &Normal");
00243         menu->setItemEnabled (MENU_ID_WINDOW_FULLSCREEN, false);
00244         mainWindow->showMaximized ();
00245     }
00246 }

IgQtSiteStack * IgPage::stackArea ( void   ) 

Definition at line 196 of file IgPage.cc.

References m_stackArea.

Referenced by IgIVView::IgIVView(), IgMDIView::IgMDIView(), VisApplicationMain::setup(), and IgNTupleAppMain::setup().

00197 {
00198     return m_stackArea;
00199 }

IgState * IgPage::state ( void   )  const [virtual]

Definition at line 165 of file IgPage.cc.

References m_document, and IgDocument::state().

Referenced by getModelFromManager(), Ig2DWindow::Ig2DWindow(), Ig3DBaseWindow::Ig3DBaseWindow(), IgIVView::IgIVView(), IgLegoWindow::IgLegoWindow(), IgMDIView::IgMDIView(), IgPage(), IgRPhiWindow::IgRPhiWindow(), IgRZWindow::IgRZWindow(), IgSpareWindow::IgSpareWindow(), registerView(), VisApplicationMain::setup(), IgNTupleAppMain::setup(), and IgView::state().

00166 { return m_document->state (); }

IgQtSiteStack * IgPage::workspace ( void   ) 

Definition at line 172 of file IgPage.cc.

References m_workspace.

Referenced by getModelFromManager(), Ig2DWindow::Ig2DWindow(), Ig3DWindow::Ig3DWindow(), IgLegoWindow::IgLegoWindow(), IgRPhiWindow::IgRPhiWindow(), IgRZWindow::IgRZWindow(), IgSpareWindow::IgSpareWindow(), and VisApplicationMain::setup().

00173 {
00174     return m_workspace;
00175 }


Member Data Documentation

IgQtSite* IgPage::m_bottomDockArea [private]

Definition at line 67 of file IgPage.h.

Referenced by bottomDockArea().

IgQtSite* IgPage::m_centralSplitter [private]

Definition at line 65 of file IgPage.h.

IgDocument* IgPage::m_document [private]

Definition at line 61 of file IgPage.h.

Referenced by showFullScreen(), showMaximized(), and state().

QGridLayout* IgPage::m_layout [private]

Definition at line 62 of file IgPage.h.

IgQtSite* IgPage::m_leftDockArea [private]

Definition at line 63 of file IgPage.h.

Referenced by leftDockArea().

int IgPage::m_numRegisteredWindows [private]

Definition at line 71 of file IgPage.h.

Referenced by registerView().

IgQtSite* IgPage::m_rightDockArea [private]

Definition at line 68 of file IgPage.h.

Referenced by rightDockArea().

IgQtSiteStack* IgPage::m_stackArea [private]

Definition at line 64 of file IgPage.h.

Referenced by stackArea().

std::map<QWidget *, IgView*> IgPage::m_views [private]

Definition at line 70 of file IgPage.h.

Referenced by IgPage(), and registerView().

IgQtSiteStack* IgPage::m_workspace [private]

Definition at line 66 of file IgPage.h.

Referenced by IgPage(), and workspace().

const int IgPage::MENU_ID_FILE_NEW = 150 [static]

Definition at line 28 of file IgPage.h.

Referenced by IgPage().

const int IgPage::MENU_ID_WINDOW = 5000 [static]

Definition at line 29 of file IgPage.h.

Referenced by IgPage(), and registerView().

const int IgPage::MENU_ID_WINDOW_CASCADE = 5002 [static]

Definition at line 31 of file IgPage.h.

Referenced by IgPage().

const int IgPage::MENU_ID_WINDOW_FULLSCREEN = 5005 [static]

Definition at line 34 of file IgPage.h.

Referenced by IgPage(), and showMaximized().

const int IgPage::MENU_ID_WINDOW_LIST_OFFSET = 6000 [static]

Definition at line 35 of file IgPage.h.

Referenced by registerView().

const int IgPage::MENU_ID_WINDOW_MAXIMIZE = 5004 [static]

Definition at line 33 of file IgPage.h.

Referenced by IgPage(), showFullScreen(), and showMaximized().

const int IgPage::MENU_ID_WINDOW_SEP = 5003 [static]

Definition at line 32 of file IgPage.h.

const int IgPage::MENU_ID_WINDOW_TILE = 5001 [static]

Definition at line 30 of file IgPage.h.

Referenced by IgPage().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:25:19 2009 for CMSSW by  doxygen 1.5.4