StatusbarInterface.hh 7.05 KB
 Jan Möbius committed Aug 05, 2009 1 /*===========================================================================*\  Jan Möbius committed Nov 25, 2010 2 3 * * * OpenFlipper *  Jan Möbius committed Jan 26, 2011 4 * Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *  Jan Möbius committed Nov 25, 2010 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 * www.openflipper.org * * * *--------------------------------------------------------------------------- * * This file is part of OpenFlipper. * * * * OpenFlipper is free software: you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as * * published by the Free Software Foundation, either version 3 of * * the License, or (at your option) any later version with the * * following exceptions: * * * * If other files instantiate templates or use macros * * or inline functions from this file, or you compile this file and * * link it with other files to produce an executable, this file does * * not by itself cause the resulting executable to be covered by the * * GNU Lesser General Public License. This exception does not however * * invalidate any other reasons why the executable file might be * * covered by the GNU Lesser General Public License. * * * * OpenFlipper is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Lesser General Public License for more details. * * * * You should have received a copy of the GNU LesserGeneral Public * * License along with OpenFlipper. If not, * * see . * * *  Jan Möbius committed Aug 05, 2009 33 34 35 \*===========================================================================*/ /*===========================================================================*\  Jan Möbius committed Nov 25, 2010 36 37 38 39 40 * * * $Revision$ * * $LastChangedBy$ * * $Date$ * * *  Jan Möbius committed Aug 05, 2009 41 \*===========================================================================*/  Jan Möbius committed Aug 29, 2008 42 43 44 45  #ifndef STATUSBARINTERFACE_HH #define STATUSBARINTERFACE_HH  Jan Möbius committed Feb 25, 2011 46 47 48 #include #include #include  Jan Möbius committed Aug 29, 2008 49   Jan Möbius committed Feb 25, 2011 50 51 52 53 54 55 56 57 58  /** \file StatusbarInterface.hh * * Interface for controlling OpenFlippers statusbar .\ref statusbarInterfacePage */ /** Namespace for Application status enum * */  Jan Möbius committed Aug 29, 2008 59 60 namespace ApplicationStatus {  Jan Möbius committed Feb 25, 2011 61 62 63 64 65 66 67 68 69 70  /** \brief Enum for the statusBar Status Icon * * This enum is used to controll the small activity icon of OpenFlipper. * See \ref statusbarInterfacePage */ enum applicationStatus { READY, //!< Status is ready (green light) PROCESSING,//!< Status is processing but system will allow interaction (yellow light) BLOCKED //!< Status is processing and blocked system will not allow interaction (red light) };  Jan Möbius committed Aug 29, 2008 71 72 73 74  }  Jan Möbius committed Feb 25, 2011 75 76 77 78 79 80 81  /** \brief Control OpenFlippers status bar * * \ref statusbarInterfacePage "Detailed description" * \n * * This interface can be used to send messages to OpenFlippers statusbar. * It is also possible to add your own widget to the bar.  Jan Möbius committed Aug 29, 2008 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98  */ class StatusbarInterface { private slots : public : /// Destructor virtual ~StatusbarInterface() {}; signals : /** \brief Show a message in the status bar * * You can specify a timeout if the message should be removed after * _timeout milliseconds */  Jan Möbius committed Feb 25, 2011 99  virtual void showStatusMessage(QString _message, int _timeout = 0) {};  Jan Möbius committed Aug 29, 2008 100 101   Jan Möbius committed Feb 25, 2011 102 103 104 105  /** \brief Sets the status icon of the StatusBar * * OpenFlipper statusbar contains a small icon in the statusbar which can be used to indicate * the current status of the application. The valid values are defined in the enum ApplicationStatus::applicationStatus.  Jan Möbius committed Aug 29, 2008 106  *  Jan Möbius committed Feb 25, 2011 107  * @param _status New status  Jan Möbius committed Aug 29, 2008 108  */  Jan Möbius committed Feb 25, 2011 109  void setStatus( ApplicationStatus::applicationStatus _status) {};  Jan Möbius committed Aug 29, 2008 110 111 112 113 114 115  /** \brief Removes the current message from the statusBar * */ void clearStatusMessage() {};  Dirk Wilden committed Feb 09, 2010 116 117  /** \brief Add a widget on the right side of the statusBar *  Jan Möbius committed Feb 25, 2011 118 119 120 121  * Use this function if you want to add an additional widget to the statusbar. * It will be added on the right side. * * @param _widget The widget that should be added to the statusbar  Dirk Wilden committed Feb 09, 2010 122  */  Jan Möbius committed Feb 25, 2011 123  void addWidgetToStatusbar(QWidget* _widget) {};  Dirk Wilden committed Feb 09, 2010 124   Jan Möbius committed Aug 29, 2008 125 126 };  Jan Möbius committed Feb 25, 2011 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141  /** \page statusbarInterfacePage Statusbar Interface \image html StatusbarInterface.png \n The StatusbarInterface can be used by plugins to send messages to OpenFlippers statusbar. The statusbar is located below the GL viewer. Messages can be controlled via StatusbarInterface::setStatus(),StatusbarInterface::clearStatusMessage() Additionally it is possible to add small widgets to it ( StatusbarInterface::addWidgetToStatusbar). A small icon can be controlled to indicate OpenFlippers status via StatusbarInterface::setStatus(). To use the StatusbarInterface:
 Jan Möbius committed Mar 01, 2011 142 
• include StatusbarInterface.hh in your plugins header file  Jan Möbius committed Feb 25, 2011 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 
The following code shows a simple example to send a message to the statusbar. \code void ExamplePlugin::function() { ... // Print the text "Your Status Message" for 4 seconds in the statusBar emit showStatusMessage( tr("Your Status Message"), 4000 ); ... } \endcode The following code shows a simple example to add a widget to the statusbar. Usually you should implement the BaseInterface::pluginsInitialized() function from BaseInterface. In this function you can setup your widget for the status bar. \code void ExamplePlugin::pluginsInitialized() { // Create the widget QWidget* infoBar = new QWidget(); // Setup buttons or anything else in your widget ... // Add the new widget to the statusBar emit addWidgetToStatusbar(infoBar); } \endcode */  Jan Möbius committed Aug 29, 2008 184 185 186 Q_DECLARE_INTERFACE(StatusbarInterface,"OpenFlipper.StatusbarInterface/1.0") #endif // STATUSBARINTERFACE_HH