]> Dogcows Code - chaz/openbox/blob - src/openbox.hh
updated doxygen documentation
[chaz/openbox] / src / openbox.hh
1 // -*- mode: C++; indent-tabs-mode: nil; -*-
2 #ifndef __openbox_hh
3 #define __openbox_hh
4
5 /*! @file openbox.hh
6 @brief The main class for the Openbox window manager
7 */
8
9 extern "C" {
10 #include <X11/Xlib.h>
11 }
12
13 #include <string>
14 #include <vector>
15
16 #include "otk/screeninfo.hh"
17 #include "otk/timerqueuemanager.hh"
18 #include "xeventhandler.hh"
19
20 namespace ob {
21
22 //! The main class for the Openbox window manager.
23 /*!
24 Only a single instance of the Openbox class may be used in the application. A
25 pointer to this instance is held in the Openbox::instance static member
26 variable.
27 Instantiation of this class begins the window manager. After instantiation,
28 the Openbox::eventLoop function should be called. The eventLoop method does
29 not exit until the window manager is ready to be destroyed. Destruction of
30 the Openbox class instance will shutdown the window manager.
31 */
32 class Openbox
33 {
34 public:
35 //! The single instance of the Openbox class for the application.
36 /*!
37 Since this variable is globally available in the application, the Openbox
38 class does not need to be passed around to any of the other classes.
39 */
40 static Openbox *instance;
41
42 //! The posible running states of the window manager
43 enum RunState {
44 State_Starting, //!< The window manager is starting up (being created)
45 State_Normal, //!< The window manager is running in its normal state
46 State_Exiting //!< The window manager is exiting (being destroyed)
47 };
48
49 private:
50 // stuff that can be passed on the command line
51 //! Path to the config file to use/in use
52 /*!
53 Defaults to $(HOME)/.openbox/rc3
54 */
55 std::string _rcfilepath;
56 //! Path to the menu file to use/in use
57 /*!
58 Defaults to $(HOME)/.openbox/menu3
59 */
60 std::string _menufilepath;
61 //! The display requested by the user, or null to use the DISPLAY env var
62 char *_displayreq;
63 //! The value of argv[0], i.e. how this application was executed
64 char *_argv0;
65
66 //! Manages all timers for the application
67 /*!
68 Use of the otk::OBTimerQueueManager::fire funtion in this object ensures
69 that all timers fire when their times elapse.
70 */
71 otk::OBTimerQueueManager _timermanager;
72
73 //! The class which will handle raw XEvents
74 OBXEventHandler _xeventhandler;
75
76 //! The running state of the window manager
77 RunState _state;
78
79 //! When set to true, the Openbox::eventLoop function will stop and return
80 bool _doshutdown;
81
82 //! Parses the command line used when executing this application
83 void parseCommandLine(int argv, char **argv);
84 //! Displays the version string to stdout
85 void showVersion();
86 //! Displays usage information and help to stdout
87 void showHelp();
88
89 //! Handles signal events for the application
90 static void signalHandler(int signal);
91
92 public:
93 //! Openbox constructor.
94 /*!
95 \param argc Number of command line arguments, as received in main()
96 \param argv The command line arguments, as received in main()
97 */
98 Openbox(int argc, char **argv);
99 //! Openbox destructor.
100 virtual ~Openbox();
101
102 //! Returns the state of the window manager (starting, exiting, etc)
103 inline RunState state() const { return _state; }
104
105 //! Returns the otk::OBTimerQueueManager for the application
106 /*!
107 All otk::OBTimer objects used in the application should be made to use this
108 otk::OBTimerQueueManager.
109 */
110 inline otk::OBTimerQueueManager *timerManager() { return &_timermanager; }
111
112 //! The main function of the Openbox class
113 /*!
114 This function should be called after instantiating the Openbox class.
115 Loops indefinately while handling all events in the application.
116 The Openbox::shutdown method will cause this function to exit.
117 */
118 void eventLoop();
119
120 //! Requests that the window manager exit
121 /*!
122 Causes the Openbox::eventLoop function to stop looping, so that the window
123 manager can be destroyed.
124 */
125 inline void shutdown() { _doshutdown = true; }
126 };
127
128 }
129
130 #endif // __openbox_hh
This page took 0.038831 seconds and 4 git commands to generate.