framemanager.h 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: aui/aui.h
  3. // Purpose: interface of wxAuiManager
  4. // Author: wxWidgets team
  5. // Licence: wxWindows licence
  6. /////////////////////////////////////////////////////////////////////////////
  7. /**
  8. @todo wxAuiPaneInfo dock direction types used with wxAuiManager.
  9. */
  10. enum wxAuiManagerDock
  11. {
  12. wxAUI_DOCK_NONE = 0,
  13. wxAUI_DOCK_TOP = 1,
  14. wxAUI_DOCK_RIGHT = 2,
  15. wxAUI_DOCK_BOTTOM = 3,
  16. wxAUI_DOCK_LEFT = 4,
  17. wxAUI_DOCK_CENTER = 5,
  18. wxAUI_DOCK_CENTRE = wxAUI_DOCK_CENTER
  19. };
  20. /**
  21. wxAuiManager behaviour and visual effects style flags.
  22. */
  23. enum wxAuiManagerOption
  24. {
  25. /// Allow a pane to be undocked to take the form of a wxMiniFrame.
  26. wxAUI_MGR_ALLOW_FLOATING = 1 << 0,
  27. /// Change the color of the title bar of the pane when it is activated.
  28. wxAUI_MGR_ALLOW_ACTIVE_PANE = 1 << 1,
  29. /// Make the pane transparent during its movement.
  30. wxAUI_MGR_TRANSPARENT_DRAG = 1 << 2,
  31. /// The possible location for docking is indicated by a translucent area.
  32. wxAUI_MGR_TRANSPARENT_HINT = 1 << 3,
  33. /// The possible location for docking is indicated by a gradually appearing
  34. /// partially transparent area.
  35. wxAUI_MGR_VENETIAN_BLINDS_HINT = 1 << 4,
  36. /// The possible location for docking is indicated by a rectangular outline.
  37. wxAUI_MGR_RECTANGLE_HINT = 1 << 5,
  38. /// The translucent area where the pane could be docked appears gradually.
  39. wxAUI_MGR_HINT_FADE = 1 << 6,
  40. /// Used in complement of wxAUI_MGR_VENETIAN_BLINDS_HINT to show the hint immediately.
  41. wxAUI_MGR_NO_VENETIAN_BLINDS_FADE = 1 << 7,
  42. /// When a docked pane is resized, its content is refreshed in live (instead of moving
  43. /// the border alone and refreshing the content at the end).
  44. wxAUI_MGR_LIVE_RESIZE = 1 << 8,
  45. /// Default behavior.
  46. wxAUI_MGR_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
  47. wxAUI_MGR_TRANSPARENT_HINT |
  48. wxAUI_MGR_HINT_FADE |
  49. wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
  50. };
  51. /**
  52. @class wxAuiManager
  53. wxAuiManager is the central class of the wxAUI class framework.
  54. wxAuiManager manages the panes associated with it for a particular wxFrame,
  55. using a pane's wxAuiPaneInfo information to determine each pane's docking
  56. and floating behaviour.
  57. wxAuiManager uses wxWidgets' sizer mechanism to plan the layout of each
  58. frame. It uses a replaceable dock art class to do all drawing, so all
  59. drawing is localized in one area, and may be customized depending on an
  60. application's specific needs.
  61. wxAuiManager works as follows: the programmer adds panes to the class,
  62. or makes changes to existing pane properties (dock position, floating
  63. state, show state, etc.). To apply these changes, wxAuiManager's
  64. Update() function is called. This batch processing can be used to avoid
  65. flicker, by modifying more than one pane at a time, and then "committing"
  66. all of the changes at once by calling Update().
  67. Panes can be added quite easily:
  68. @code
  69. wxTextCtrl* text1 = new wxTextCtrl(this, -1);
  70. wxTextCtrl* text2 = new wxTextCtrl(this, -1);
  71. m_mgr.AddPane(text1, wxLEFT, "Pane Caption");
  72. m_mgr.AddPane(text2, wxBOTTOM, "Pane Caption");
  73. m_mgr.Update();
  74. @endcode
  75. Later on, the positions can be modified easily. The following will float
  76. an existing pane in a tool window:
  77. @code
  78. m_mgr.GetPane(text1).Float();
  79. @endcode
  80. @section auimanager_layers Layers, Rows and Directions, Positions
  81. Inside wxAUI, the docking layout is figured out by checking several pane
  82. parameters. Four of these are important for determining where a pane will
  83. end up:
  84. @li Direction: Each docked pane has a direction, Top, Bottom, Left, Right,
  85. or Center. This is fairly self-explanatory. The pane will be placed in
  86. the location specified by this variable.
  87. @li Position: More than one pane can be placed inside of a dock. Imagine
  88. two panes being docked on the left side of a window. One pane can be
  89. placed over another. In proportionally managed docks, the pane
  90. position indicates its sequential position, starting with zero. So, in
  91. our scenario with two panes docked on the left side, the top pane in
  92. the dock would have position 0, and the second one would occupy
  93. position 1.
  94. @li Row: A row can allow for two docks to be placed next to each other.
  95. One of the most common places for this to happen is in the toolbar.
  96. Multiple toolbar rows are allowed, the first row being row 0, and the
  97. second row 1. Rows can also be used on vertically docked panes.
  98. @li Layer: A layer is akin to an onion. Layer 0 is the very center of the
  99. managed pane. Thus, if a pane is in layer 0, it will be closest to the
  100. center window (also sometimes known as the "content window").
  101. Increasing layers "swallow up" all layers of a lower value. This can
  102. look very similar to multiple rows, but is different because all panes
  103. in a lower level yield to panes in higher levels. The best way to
  104. understand layers is by running the wxAUI sample.
  105. @beginStyleTable
  106. @style{wxAUI_MGR_ALLOW_FLOATING}
  107. Allow a pane to be undocked to take the form of a wxMiniFrame.
  108. @style{wxAUI_MGR_ALLOW_ACTIVE_PANE}
  109. Change the color of the title bar of the pane when it is activated.
  110. @style{wxAUI_MGR_TRANSPARENT_DRAG}
  111. Make the pane transparent during its movement.
  112. @style{wxAUI_MGR_TRANSPARENT_HINT}
  113. The possible location for docking is indicated by a translucent area.
  114. @style{wxAUI_MGR_VENETIAN_BLINDS_HINT}
  115. The possible location for docking is indicated by gradually
  116. appearing partially transparent hint.
  117. @style{wxAUI_MGR_RECTANGLE_HINT}
  118. The possible location for docking is indicated by a rectangular
  119. outline.
  120. @style{wxAUI_MGR_HINT_FADE}
  121. The translucent area where the pane could be docked appears gradually.
  122. @style{wxAUI_MGR_NO_VENETIAN_BLINDS_FADE}
  123. Used in complement of wxAUI_MGR_VENETIAN_BLINDS_HINT to show the
  124. docking hint immediately.
  125. @style{wxAUI_MGR_LIVE_RESIZE}
  126. When a docked pane is resized, its content is refreshed in live (instead of moving
  127. the border alone and refreshing the content at the end).
  128. @style{wxAUI_MGR_DEFAULT}
  129. Default behavior, combines: wxAUI_MGR_ALLOW_FLOATING | wxAUI_MGR_TRANSPARENT_HINT |
  130. wxAUI_MGR_HINT_FADE | wxAUI_MGR_NO_VENETIAN_BLINDS_FADE.
  131. @endStyleTable
  132. @beginEventEmissionTable{wxAuiManagerEvent}
  133. @event{EVT_AUI_PANE_BUTTON(func)}
  134. Triggered when any button is pressed for any docked panes.
  135. @event{EVT_AUI_PANE_CLOSE(func)}
  136. Triggered when a docked or floating pane is closed.
  137. @event{EVT_AUI_PANE_MAXIMIZE(func)}
  138. Triggered when a pane is maximized.
  139. @event{EVT_AUI_PANE_RESTORE(func)}
  140. Triggered when a pane is restored.
  141. @event{EVT_AUI_PANE_ACTIVATED(func)}
  142. Triggered when a pane is made 'active'. This event is new since
  143. wxWidgets 2.9.4.
  144. @event{EVT_AUI_RENDER(func)}
  145. This event can be caught to override the default renderer in order to
  146. custom draw your wxAuiManager window (not recommended).
  147. @endEventTable
  148. @library{wxaui}
  149. @category{aui}
  150. @see @ref overview_aui, wxAuiNotebook, wxAuiDockArt, wxAuiPaneInfo
  151. */
  152. class wxAuiManager : public wxEvtHandler
  153. {
  154. public:
  155. /**
  156. Constructor.
  157. @param managed_wnd
  158. Specifies the wxFrame which should be managed.
  159. @param flags
  160. Specifies the frame management behaviour and visual effects
  161. with the ::wxAuiManagerOption's style flags.
  162. */
  163. wxAuiManager(wxWindow* managed_wnd = NULL,
  164. unsigned int flags = wxAUI_MGR_DEFAULT);
  165. /**
  166. Dtor.
  167. */
  168. virtual ~wxAuiManager();
  169. //@{
  170. /**
  171. AddPane() tells the frame manager to start managing a child window.
  172. There are several versions of this function. The first version allows
  173. the full spectrum of pane parameter possibilities. The second version is
  174. used for simpler user interfaces which do not require as much configuration.
  175. The last version allows a drop position to be specified, which will determine
  176. where the pane will be added.
  177. */
  178. bool AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info);
  179. bool AddPane(wxWindow* window, int direction = wxLEFT,
  180. const wxString& caption = wxEmptyString);
  181. bool AddPane(wxWindow* window,
  182. const wxAuiPaneInfo& pane_info,
  183. const wxPoint& drop_pos);
  184. //@}
  185. /**
  186. Tells the wxAuiManager to stop managing the pane specified by window.
  187. The window, if in a floated frame, is reparented to the frame managed
  188. by wxAuiManager.
  189. */
  190. bool DetachPane(wxWindow* window);
  191. /**
  192. Returns an array of all panes managed by the frame manager.
  193. */
  194. wxAuiPaneInfoArray& GetAllPanes();
  195. /**
  196. Returns the current art provider being used.
  197. @see wxAuiDockArt.
  198. */
  199. wxAuiDockArt* GetArtProvider() const;
  200. /**
  201. Returns the current dock constraint values.
  202. See SetDockSizeConstraint() for more information.
  203. */
  204. void GetDockSizeConstraint(double* widthpct, double* heightpct) const;
  205. /**
  206. Returns the current ::wxAuiManagerOption's flags.
  207. */
  208. unsigned int GetFlags() const;
  209. /**
  210. Returns the frame currently being managed by wxAuiManager.
  211. */
  212. wxWindow* GetManagedWindow() const;
  213. /**
  214. Calling this method will return the wxAuiManager for a given window.
  215. The @a window parameter should specify any child window or sub-child
  216. window of the frame or window managed by wxAuiManager.
  217. The @a window parameter need not be managed by the manager itself, nor does it
  218. even need to be a child or sub-child of a managed window. It must however
  219. be inside the window hierarchy underneath the managed window.
  220. */
  221. static wxAuiManager* GetManager(wxWindow* window);
  222. //@{
  223. /**
  224. GetPane() is used to lookup a wxAuiPaneInfo object either by window pointer
  225. or by pane name, which acts as a unique id for a window pane.
  226. The returned wxAuiPaneInfo object may then be modified to change a pane's
  227. look, state or position. After one or more modifications to wxAuiPaneInfo,
  228. wxAuiManager::Update() should be called to commit the changes to the user
  229. interface. If the lookup failed (meaning the pane could not be found in the
  230. manager), a call to the returned wxAuiPaneInfo's IsOk() method will return @false.
  231. */
  232. wxAuiPaneInfo& GetPane(wxWindow* window);
  233. wxAuiPaneInfo& GetPane(const wxString& name);
  234. //@}
  235. /**
  236. HideHint() hides any docking hint that may be visible.
  237. */
  238. virtual void HideHint();
  239. /**
  240. This method is used to insert either a previously unmanaged pane window
  241. into the frame manager, or to insert a currently managed pane somewhere
  242. else. InsertPane() will push all panes, rows, or docks aside and
  243. insert the window into the position specified by @a insert_location.
  244. Because @a insert_location can specify either a pane, dock row, or dock
  245. layer, the @a insert_level parameter is used to disambiguate this.
  246. The parameter @a insert_level can take a value of wxAUI_INSERT_PANE,
  247. wxAUI_INSERT_ROW or wxAUI_INSERT_DOCK.
  248. */
  249. bool InsertPane(wxWindow* window,
  250. const wxAuiPaneInfo& insert_location,
  251. int insert_level = wxAUI_INSERT_PANE);
  252. /**
  253. LoadPaneInfo() is similar to LoadPerspective, with the exception that it
  254. only loads information about a single pane. It is used in combination with
  255. SavePaneInfo().
  256. */
  257. void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo& pane);
  258. /**
  259. Loads a saved perspective. If update is @true, wxAuiManager::Update()
  260. is automatically invoked, thus realizing the saved perspective on screen.
  261. */
  262. bool LoadPerspective(const wxString& perspective,
  263. bool update = true);
  264. /**
  265. SavePaneInfo() is similar to SavePerspective, with the exception that it only
  266. saves information about a single pane. It is used in combination with
  267. LoadPaneInfo().
  268. */
  269. wxString SavePaneInfo(wxAuiPaneInfo& pane);
  270. /**
  271. Saves the entire user interface layout into an encoded wxString, which
  272. can then be stored by the application (probably using wxConfig).
  273. When a perspective is restored using LoadPerspective(), the entire user
  274. interface will return to the state it was when the perspective was saved.
  275. */
  276. wxString SavePerspective();
  277. /**
  278. Instructs wxAuiManager to use art provider specified by parameter
  279. @a art_provider for all drawing calls.
  280. This allows plugable look-and-feel features. The previous art provider object,
  281. if any, will be deleted by wxAuiManager.
  282. @see wxAuiDockArt.
  283. */
  284. void SetArtProvider(wxAuiDockArt* art_provider);
  285. /**
  286. When a user creates a new dock by dragging a window into a docked position,
  287. often times the large size of the window will create a dock that is unwieldly
  288. large. wxAuiManager by default limits the size of any new dock to 1/3 of the
  289. window size. For horizontal docks, this would be 1/3 of the window height.
  290. For vertical docks, 1/3 of the width.
  291. Calling this function will adjust this constraint value. The numbers must be
  292. between 0.0 and 1.0. For instance, calling SetDockSizeContraint with
  293. 0.5, 0.5 will cause new docks to be limited to half of the size of the
  294. entire managed window.
  295. */
  296. void SetDockSizeConstraint(double widthpct, double heightpct);
  297. /**
  298. This method is used to specify ::wxAuiManagerOption's flags. @a flags
  299. specifies options which allow the frame management behaviour to be modified.
  300. */
  301. void SetFlags(unsigned int flags);
  302. /**
  303. Called to specify the frame or window which is to be managed by wxAuiManager.
  304. Frame management is not restricted to just frames. Child windows or custom
  305. controls are also allowed.
  306. */
  307. void SetManagedWindow(wxWindow* managed_wnd);
  308. /**
  309. This function is used by controls to explicitly show a hint window at the
  310. specified rectangle. It is rarely called, and is mostly used by controls
  311. implementing custom pane drag/drop behaviour.
  312. The specified rectangle should be in screen coordinates.
  313. */
  314. virtual void ShowHint(const wxRect& rect);
  315. /**
  316. Uninitializes the framework and should be called before a managed frame or
  317. window is destroyed. UnInit() is usually called in the managed wxFrame's
  318. destructor. It is necessary to call this function before the managed frame
  319. or window is destroyed, otherwise the manager cannot remove its custom event
  320. handlers from a window.
  321. */
  322. void UnInit();
  323. /**
  324. This method is called after any number of changes are
  325. made to any of the managed panes. Update() must be invoked after
  326. AddPane() or InsertPane() are called in order to "realize" or "commit"
  327. the changes. In addition, any number of changes may be made to
  328. wxAuiPaneInfo structures (retrieved with wxAuiManager::GetPane), but to
  329. realize the changes, Update() must be called. This construction allows
  330. pane flicker to be avoided by updating the whole layout at one time.
  331. */
  332. void Update();
  333. protected:
  334. /**
  335. ProcessDockResult() is a protected member of the wxAUI layout manager.
  336. It can be overridden by derived classes to provide custom docking calculations.
  337. */
  338. virtual bool ProcessDockResult(wxAuiPaneInfo& target,
  339. const wxAuiPaneInfo& new_pos);
  340. };
  341. /**
  342. @class wxAuiPaneInfo
  343. wxAuiPaneInfo is part of the wxAUI class framework.
  344. See also @ref overview_aui.
  345. wxAuiPaneInfo specifies all the parameters for a pane.
  346. These parameters specify where the pane is on the screen, whether it is docked
  347. or floating, or hidden.
  348. In addition, these parameters specify the pane's docked position, floating
  349. position, preferred size, minimum size, caption text among many other parameters.
  350. @library{wxaui}
  351. @category{aui}
  352. @see wxAuiManager, wxAuiDockArt
  353. */
  354. class wxAuiPaneInfo
  355. {
  356. public:
  357. wxAuiPaneInfo();
  358. /**
  359. Copy constructor.
  360. */
  361. wxAuiPaneInfo(const wxAuiPaneInfo& c);
  362. //@{
  363. /**
  364. BestSize() sets the ideal size for the pane. The docking manager will attempt
  365. to use this size as much as possible when docking or floating the pane.
  366. */
  367. wxAuiPaneInfo& BestSize(const wxSize& size);
  368. wxAuiPaneInfo& BestSize(int x, int y);
  369. //@}
  370. /**
  371. Bottom() sets the pane dock position to the bottom side of the frame. This is
  372. the same thing as calling Direction(wxAUI_DOCK_BOTTOM).
  373. */
  374. wxAuiPaneInfo& Bottom();
  375. /**
  376. BottomDockable() indicates whether a pane can be docked at the bottom of the
  377. frame.
  378. */
  379. wxAuiPaneInfo& BottomDockable(bool b = true);
  380. /**
  381. Caption() sets the caption of the pane.
  382. */
  383. wxAuiPaneInfo& Caption(const wxString& c);
  384. /**
  385. CaptionVisible indicates that a pane caption should be visible. If @false, no
  386. pane caption is drawn.
  387. */
  388. wxAuiPaneInfo& CaptionVisible(bool visible = true);
  389. //@{
  390. /**
  391. Center() sets the pane dock position to the left side of the frame.
  392. The centre pane is the space in the middle after all border panes (left, top,
  393. right, bottom) are subtracted from the layout.
  394. This is the same thing as calling Direction(wxAUI_DOCK_CENTRE).
  395. */
  396. wxAuiPaneInfo& Centre();
  397. wxAuiPaneInfo& Center();
  398. //@}
  399. //@{
  400. /**
  401. CentrePane() specifies that the pane should adopt the default center pane
  402. settings. Centre panes usually do not have caption bars.
  403. This function provides an easy way of preparing a pane to be displayed in
  404. the center dock position.
  405. */
  406. wxAuiPaneInfo& CentrePane();
  407. wxAuiPaneInfo& CenterPane();
  408. //@}
  409. /**
  410. CloseButton() indicates that a close button should be drawn for the pane.
  411. */
  412. wxAuiPaneInfo& CloseButton(bool visible = true);
  413. /**
  414. DefaultPane() specifies that the pane should adopt the default pane settings.
  415. */
  416. wxAuiPaneInfo& DefaultPane();
  417. /**
  418. DestroyOnClose() indicates whether a pane should be destroyed when it is closed.
  419. Normally a pane is simply hidden when the close button is clicked.
  420. Setting DestroyOnClose to @true will cause the window to be destroyed when
  421. the user clicks the pane's close button.
  422. */
  423. wxAuiPaneInfo& DestroyOnClose(bool b = true);
  424. /**
  425. Direction() determines the direction of the docked pane. It is functionally the
  426. same as calling Left(), Right(), Top() or Bottom(), except that docking direction
  427. may be specified programmatically via the parameter.
  428. */
  429. wxAuiPaneInfo& Direction(int direction);
  430. /**
  431. Dock() indicates that a pane should be docked. It is the opposite of Float().
  432. */
  433. wxAuiPaneInfo& Dock();
  434. /**
  435. DockFixed() causes the containing dock to have no resize sash. This is useful
  436. for creating panes that span the entire width or height of a dock, but should
  437. not be resizable in the other direction.
  438. */
  439. wxAuiPaneInfo& DockFixed(bool b = true);
  440. /**
  441. Dockable() specifies whether a frame can be docked or not. It is the same as
  442. specifying TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b).
  443. */
  444. wxAuiPaneInfo& Dockable(bool b = true);
  445. /**
  446. Fixed() forces a pane to be fixed size so that it cannot be resized. After
  447. calling Fixed(), IsFixed() will return @true.
  448. */
  449. wxAuiPaneInfo& Fixed();
  450. /**
  451. Float() indicates that a pane should be floated. It is the opposite of Dock().
  452. */
  453. wxAuiPaneInfo& Float();
  454. /**
  455. Floatable() sets whether the user will be able to undock a pane and turn it
  456. into a floating window.
  457. */
  458. wxAuiPaneInfo& Floatable(bool b = true);
  459. //@{
  460. /**
  461. FloatingPosition() sets the position of the floating pane.
  462. */
  463. wxAuiPaneInfo& FloatingPosition(const wxPoint& pos);
  464. wxAuiPaneInfo& FloatingPosition(int x, int y);
  465. //@}
  466. //@{
  467. /**
  468. FloatingSize() sets the size of the floating pane.
  469. */
  470. wxAuiPaneInfo& FloatingSize(const wxSize& size);
  471. wxAuiPaneInfo& FloatingSize(int x, int y);
  472. //@}
  473. /**
  474. Gripper() indicates that a gripper should be drawn for the pane.
  475. */
  476. wxAuiPaneInfo& Gripper(bool visible = true);
  477. /**
  478. GripperTop() indicates that a gripper should be drawn at the top of the pane.
  479. */
  480. wxAuiPaneInfo& GripperTop(bool attop = true);
  481. /**
  482. HasBorder() returns @true if the pane displays a border.
  483. */
  484. bool HasBorder() const;
  485. /**
  486. HasCaption() returns @true if the pane displays a caption.
  487. */
  488. bool HasCaption() const;
  489. /**
  490. HasCloseButton() returns @true if the pane displays a button to close the pane.
  491. */
  492. bool HasCloseButton() const;
  493. /**
  494. HasFlag() returns @true if the property specified by flag is active for
  495. the pane.
  496. */
  497. bool HasFlag(int flag) const;
  498. /**
  499. HasGripper() returns @true if the pane displays a gripper.
  500. */
  501. bool HasGripper() const;
  502. /**
  503. HasGripper() returns @true if the pane displays a gripper at the top.
  504. */
  505. bool HasGripperTop() const;
  506. /**
  507. HasMaximizeButton() returns @true if the pane displays a button to maximize the
  508. pane.
  509. */
  510. bool HasMaximizeButton() const;
  511. /**
  512. HasMinimizeButton() returns @true if the pane displays a button to minimize the
  513. pane.
  514. */
  515. bool HasMinimizeButton() const;
  516. /**
  517. HasPinButton() returns @true if the pane displays a button to float the pane.
  518. */
  519. bool HasPinButton() const;
  520. /**
  521. Hide() indicates that a pane should be hidden.
  522. */
  523. wxAuiPaneInfo& Hide();
  524. /**
  525. Icon() sets the icon of the pane.
  526. Notice that the height of the icon should be smaller than the value
  527. returned by wxAuiDockArt::GetMetric(wxAUI_DOCKART_CAPTION_SIZE) to
  528. ensure that it appears correctly.
  529. @since 2.9.2
  530. */
  531. wxAuiPaneInfo& Icon(const wxBitmap& b);
  532. /**
  533. IsBottomDockable() returns @true if the pane can be docked at the bottom of the
  534. managed frame.
  535. @see IsDockable()
  536. */
  537. bool IsBottomDockable() const;
  538. /**
  539. Returns @true if the pane can be docked at any side.
  540. @see IsTopDockable(), IsBottomDockable(), IsLeftDockable(), IsRightDockable()
  541. @since 2.9.2
  542. */
  543. bool IsDockable() const;
  544. /**
  545. IsDocked() returns @true if the pane is currently docked.
  546. */
  547. bool IsDocked() const;
  548. /**
  549. IsFixed() returns @true if the pane cannot be resized.
  550. */
  551. bool IsFixed() const;
  552. /**
  553. IsFloatable() returns @true if the pane can be undocked and displayed as a
  554. floating window.
  555. */
  556. bool IsFloatable() const;
  557. /**
  558. IsFloating() returns @true if the pane is floating.
  559. */
  560. bool IsFloating() const;
  561. /**
  562. IsLeftDockable() returns @true if the pane can be docked on the left of the
  563. managed frame.
  564. @see IsDockable()
  565. */
  566. bool IsLeftDockable() const;
  567. /**
  568. IsMoveable() returns @true if the docked frame can be undocked or moved to
  569. another dock position.
  570. */
  571. bool IsMovable() const;
  572. /**
  573. IsOk() returns @true if the wxAuiPaneInfo structure is valid. A pane structure
  574. is valid if it has an associated window.
  575. */
  576. bool IsOk() const;
  577. /**
  578. IsResizable() returns @true if the pane can be resized.
  579. */
  580. bool IsResizable() const;
  581. /**
  582. IsRightDockable() returns @true if the pane can be docked on the right of the
  583. managed frame.
  584. @see IsDockable()
  585. */
  586. bool IsRightDockable() const;
  587. /**
  588. IsShown() returns @true if the pane is currently shown.
  589. */
  590. bool IsShown() const;
  591. /**
  592. IsToolbar() returns @true if the pane contains a toolbar.
  593. */
  594. bool IsToolbar() const;
  595. /**
  596. IsTopDockable() returns @true if the pane can be docked at the top of the
  597. managed frame.
  598. @see IsDockable()
  599. */
  600. bool IsTopDockable() const;
  601. /**
  602. Layer() determines the layer of the docked pane. The dock layer is similar to
  603. an onion, the inner-most layer being layer 0. Each shell moving in the outward
  604. direction has a higher layer number. This allows for more complex docking layout
  605. formation.
  606. */
  607. wxAuiPaneInfo& Layer(int layer);
  608. /**
  609. Left() sets the pane dock position to the left side of the frame. This is the
  610. same thing as calling Direction(wxAUI_DOCK_LEFT).
  611. */
  612. wxAuiPaneInfo& Left();
  613. /**
  614. LeftDockable() indicates whether a pane can be docked on the left of the frame.
  615. */
  616. wxAuiPaneInfo& LeftDockable(bool b = true);
  617. //@{
  618. /**
  619. MaxSize() sets the maximum size of the pane.
  620. */
  621. wxAuiPaneInfo& MaxSize(const wxSize& size);
  622. wxAuiPaneInfo& MaxSize(int x, int y);
  623. //@}
  624. /**
  625. MaximizeButton() indicates that a maximize button should be drawn for the pane.
  626. */
  627. wxAuiPaneInfo& MaximizeButton(bool visible = true);
  628. //@{
  629. /**
  630. MinSize() sets the minimum size of the pane. Please note that this is only
  631. partially supported as of this writing.
  632. */
  633. wxAuiPaneInfo& MinSize(const wxSize& size);
  634. wxAuiPaneInfo& MinSize(int x, int y);
  635. //@}
  636. /**
  637. MinimizeButton() indicates that a minimize button should be drawn for the pane.
  638. */
  639. wxAuiPaneInfo& MinimizeButton(bool visible = true);
  640. /**
  641. Movable indicates whether a frame can be moved.
  642. */
  643. wxAuiPaneInfo& Movable(bool b = true);
  644. /**
  645. Name() sets the name of the pane so it can be referenced in lookup functions.
  646. If a name is not specified by the user, a random name is assigned to the pane
  647. when it is added to the manager.
  648. */
  649. wxAuiPaneInfo& Name(const wxString& n);
  650. /**
  651. PaneBorder indicates that a border should be drawn for the pane.
  652. */
  653. wxAuiPaneInfo& PaneBorder(bool visible = true);
  654. /**
  655. PinButton() indicates that a pin button should be drawn for the pane.
  656. */
  657. wxAuiPaneInfo& PinButton(bool visible = true);
  658. /**
  659. Position() determines the position of the docked pane.
  660. */
  661. wxAuiPaneInfo& Position(int pos);
  662. /**
  663. Resizable() allows a pane to be resized if the parameter is @true, and forces it
  664. to be a fixed size if the parameter is @false. This is simply an antonym for Fixed().
  665. */
  666. wxAuiPaneInfo& Resizable(bool resizable = true);
  667. /**
  668. Right() sets the pane dock position to the right side of the frame.
  669. */
  670. wxAuiPaneInfo& Right();
  671. /**
  672. RightDockable() indicates whether a pane can be docked on the right of the
  673. frame.
  674. */
  675. wxAuiPaneInfo& RightDockable(bool b = true);
  676. /**
  677. Row() determines the row of the docked pane.
  678. */
  679. wxAuiPaneInfo& Row(int row);
  680. /**
  681. Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
  682. used on loading perspectives etc.
  683. */
  684. void SafeSet(wxAuiPaneInfo source);
  685. /**
  686. SetFlag() turns the property given by flag on or off with the option_state
  687. parameter.
  688. */
  689. wxAuiPaneInfo& SetFlag(int flag, bool option_state);
  690. /**
  691. Show() indicates that a pane should be shown.
  692. */
  693. wxAuiPaneInfo& Show(bool show = true);
  694. /**
  695. ToolbarPane() specifies that the pane should adopt the default toolbar pane
  696. settings.
  697. */
  698. wxAuiPaneInfo& ToolbarPane();
  699. /**
  700. Top() sets the pane dock position to the top of the frame.
  701. */
  702. wxAuiPaneInfo& Top();
  703. /**
  704. TopDockable() indicates whether a pane can be docked at the top of the frame.
  705. */
  706. wxAuiPaneInfo& TopDockable(bool b = true);
  707. /**
  708. Window() assigns the window pointer that the wxAuiPaneInfo should use.
  709. This normally does not need to be specified, as the window pointer is
  710. automatically assigned to the wxAuiPaneInfo structure as soon as it is added
  711. to the manager.
  712. */
  713. wxAuiPaneInfo& Window(wxWindow* w);
  714. /**
  715. Makes a copy of the wxAuiPaneInfo object.
  716. */
  717. wxAuiPaneInfo& operator=(const wxAuiPaneInfo& c);
  718. };
  719. /**
  720. @class wxAuiManagerEvent
  721. Event used to indicate various actions taken with wxAuiManager.
  722. See wxAuiManager for available event types.
  723. @beginEventTable{wxAuiManagerEvent}
  724. @event{EVT_AUI_PANE_BUTTON(func)}
  725. Triggered when any button is pressed for any docked panes.
  726. @event{EVT_AUI_PANE_CLOSE(func)}
  727. Triggered when a docked or floating pane is closed.
  728. @event{EVT_AUI_PANE_MAXIMIZE(func)}
  729. Triggered when a pane is maximized.
  730. @event{EVT_AUI_PANE_RESTORE(func)}
  731. Triggered when a pane is restored.
  732. @event{EVT_AUI_PANE_ACTIVATED(func)}
  733. Triggered when a pane is made 'active'. This event is new since
  734. wxWidgets 2.9.4.
  735. @event{EVT_AUI_RENDER(func)}
  736. This event can be caught to override the default renderer in order to
  737. custom draw your wxAuiManager window (not recommended).
  738. @endEventTable
  739. @library{wxaui}
  740. @category{events,aui}
  741. @see wxAuiManager, wxAuiPaneInfo
  742. */
  743. class wxAuiManagerEvent : public wxEvent
  744. {
  745. public:
  746. /**
  747. Constructor.
  748. */
  749. wxAuiManagerEvent(wxEventType type = wxEVT_NULL);
  750. /**
  751. @return @true if this event can be vetoed.
  752. @see Veto()
  753. */
  754. bool CanVeto();
  755. /**
  756. @return The ID of the button that was clicked.
  757. */
  758. int GetButton();
  759. /**
  760. @todo What is this?
  761. */
  762. wxDC* GetDC();
  763. /**
  764. @return @true if this event was vetoed.
  765. @see Veto()
  766. */
  767. bool GetVeto();
  768. /**
  769. @return The wxAuiManager this event is associated with.
  770. */
  771. wxAuiManager* GetManager();
  772. /**
  773. @return The pane this event is associated with.
  774. */
  775. wxAuiPaneInfo* GetPane();
  776. /**
  777. Sets the ID of the button clicked that triggered this event.
  778. */
  779. void SetButton(int button);
  780. /**
  781. Sets whether or not this event can be vetoed.
  782. */
  783. void SetCanVeto(bool can_veto);
  784. /**
  785. @todo What is this?
  786. */
  787. void SetDC(wxDC* pdc);
  788. /**
  789. Sets the wxAuiManager this event is associated with.
  790. */
  791. void SetManager(wxAuiManager* manager);
  792. /**
  793. Sets the pane this event is associated with.
  794. */
  795. void SetPane(wxAuiPaneInfo* pane);
  796. /**
  797. Cancels the action indicated by this event if CanVeto() is @true.
  798. */
  799. void Veto(bool veto = true);
  800. };