wex  v21.04.0
Public Types | Public Member Functions | List of all members
wex::managed_frame Class Reference

Offers an aui managed frame with a notebook multiple document interface, used by the notebook classes, and toolbar, findbar and vibar support. More...

#include <wex/managed-frame.h>

Inheritance diagram for wex::managed_frame:
Inheritance graph
[legend]

Public Types

enum  {
  HIDE_BAR , HIDE_BAR_FOCUS_STC , HIDE_BAR_FORCE , HIDE_BAR_FORCE_FOCUS_STC ,
  SHOW_BAR , SHOW_BAR_SYNC_CLOSE_ALL
}
 Enums for show_ex_bar. More...
 
typedef std::vector< std::pair< wxWindow *, wxAuiPaneInfo > > panes_t
 Panes vector with a pair of panes.
 
typedef std::vector< std::pair< std::pair< std::string, std::string >, int > > toggled_panes_t
 Toggled panes type.
 

Public Member Functions

 managed_frame (size_t maxFiles=9, const data::window &data=data::window().style(wxDEFAULT_FRAME_STYLE))
 Default constructor, registers the aui manager, and creates the bars.
 
virtual ~managed_frame ()
 Destructor, uninits the aui manager.
 
virtual bool allow_close (wxWindowID id, wxWindow *page)
 Virtual interface. More...
 
virtual bool exec_ex_command (ex_command &command)
 Executes a ex command. More...
 
virtual void on_notebook (wxWindowID id, wxWindow *page)
 Called if the notebook changed page. More...
 
virtual void print_ex (ex *ex, const std::string &text)
 Prints text in ex dialog. More...
 
virtual void record (const std::string &command)
 Allows you to perform action for a (vi) command. More...
 
virtual stcrestore_page (const std::string &key)
 Restores a previous saved current page. More...
 
virtual bool save_current_page (const std::string &key)
 Saves the current page, to restore later on.
 
virtual void sync_all ()
 Called after you checked the Sync checkbox on the options toolbar. More...
 
virtual void sync_close_all (wxWindowID id)
 Called after all pages from the notebooks are deleted. More...
 
stcopen_file (const path &filename, const data::stc &data=data::stc()) override
 overridden methods
 
void set_recent_file (const path &path) override
 Allows derived class to update file history.
 
void statusbar_clicked (const std::string &) override
 When (left) clicked, uses the get_stc() for some dialogs.
 
void statusbar_clicked_right (const std::string &) override
 Do something when statusbar is (right) clicked.
 
auto & file_history ()
 Other methods. More...
 
auto * get_debug ()
 Debugging interface.
 
auto * get_find_toolbar ()
 Returns the find toolbar.
 
auto * get_options_toolbar ()
 Returns the options toolbar.
 
auto * get_toolbar ()
 Returns the toolbar.
 
bool pane_add (const panes_t &panes, const std::string &perspective="managed frame")
 Add panes to the manager. More...
 
bool pane_is_maximized (const std::string &pane)
 Returns true if the managed pane is maximized.
 
bool pane_is_shown (const std::string &pane)
 Returns true if pane is shown.
 
bool pane_maximize (const std::string &pane)
 Maximizes the managed pane. More...
 
bool pane_restore (const std::string &pane)
 Restores the managed pane. More...
 
bool pane_set (const std::string &pane, const wxAuiPaneInfo &info)
 Updates pane info for managed pane. More...
 
bool pane_show (const std::string &pane, bool show=true)
 Shows or hides the managed pane. More...
 
bool pane_toggle (const std::string &pane)
 Toggles the managed pane: if shown hides it, otherwise shows it. More...
 
size_t panes () const
 Returns number of panes.
 
void show_ex_bar (int action=HIDE_BAR_FOCUS_STC, ex *ex=nullptr)
 Shows or hides the ex bar. More...
 
bool show_ex_command (ex *ex, const std::string &label)
 Returns a command line ex command. More...
 
bool show_ex_input (ex *ex, char command)
 Shows ex bar, and enters input mode. More...
 
void show_ex_message (const std::string &text)
 Shows text in ex bar.
 
void show_process (bool show)
 Shows or hide process pane.
 
const auto & toggled_panes () const
 Returns the toggled panes.
 
- Public Member Functions inherited from wex::frame
 frame (const data::window &data=data::window())
 Default constructor,.
 
virtual ~frame ()
 Destructor.
 
void SetMenuBar (wxMenuBar *bar) override
 Override from base class. More...
 
bool Show (bool show=true) override
 Shows or hides window.
 
virtual gridget_grid ()
 Virtual interface. More...
 
virtual listviewget_listview ()
 Returns a listview.
 
virtual processget_process (const std::string &command)
 Allows you to e.g. More...
 
virtual stcget_stc ()
 Returns an stc.
 
virtual bool is_open (const path &filename)
 Returns true if file is opened in a window.
 
virtual void on_command_item_dialog (wxWindowID, const wxCommandEvent &)
 Called when an item dialog command event is triggered.
 
virtual stcopen_file (const path &filename, const vcs_entry &vcs, const data::stc &data=data::stc())
 Allows you to open a filename with info from vcs. More...
 
virtual stcopen_file (const path &filename, const std::string &text, const data::stc &data=data::stc())
 Allows you to open a filename with specified contents. More...
 
virtual bool output (const std::string &text) const
 Allows you to handle output text, .e.g. More...
 
virtual bool statustext (const std::string &text, const std::string &pane) const
 Sets text on specified pane. More...
 
auto * get_statusbar ()
 Other methods. More...
 
std::string get_statustext (const std::string &pane) const
 Returns text on specified pane. More...
 
bool is_closing () const
 Are we closing?
 
void set_find_focus (wxWindow *focus)
 Sets the find focus to specified window.
 
statusbarsetup_statusbar (const std::vector< statusbar_pane > &panes, long style=wxST_SIZEGRIP, const std::string &name="statusBar")
 Sets up the status bar if you want to use statustext. More...
 
bool update_statusbar (const wxListView *lv)
 Updates statusbar pane items pane with values from specified listview.
 
bool update_statusbar (stc *stc, const std::string &pane)
 Updates the specified statusbar pane with values from specified stc.
 

Detailed Description

Offers an aui managed frame with a notebook multiple document interface, used by the notebook classes, and toolbar, findbar and vibar support.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Enums for show_ex_bar.

Enumerator
HIDE_BAR 

hide bar, unless there is no statusbar

HIDE_BAR_FOCUS_STC 

as previous, and focus to stc

HIDE_BAR_FORCE 

hide bar, even if there is no statusbar

HIDE_BAR_FORCE_FOCUS_STC 

as previous, and focus to stc

SHOW_BAR 

shows bar

SHOW_BAR_SYNC_CLOSE_ALL 

shows bar, but all components are closed

Member Function Documentation

◆ allow_close()

virtual bool wex::managed_frame::allow_close ( wxWindowID  id,
wxWindow *  page 
)
virtual

Virtual interface.

Returns true if the page can be closed. Default resets the find focus.

Parameters
idnotebook id
pagepage

◆ exec_ex_command()

virtual bool wex::managed_frame::exec_ex_command ( ex_command command)
inlinevirtual

Executes a ex command.

Returns true if this command is handled. This method is invoked at the beginning of the ex command handling, allowing you to override any command.

◆ file_history()

auto& wex::managed_frame::file_history ( )
inline

Other methods.

Returns file history.

◆ on_notebook()

virtual void wex::managed_frame::on_notebook ( wxWindowID  id,
wxWindow *  page 
)
virtual

Called if the notebook changed page.

Default sets the focus to page and adds page as recently used.

◆ pane_add()

bool wex::managed_frame::pane_add ( const panes_t panes,
const std::string &  perspective = "managed frame" 
)

Add panes to the manager.

Returns false if one of the panes could not be added.

Parameters
panespanes
perspectivename of perspective to load / save

◆ pane_maximize()

bool wex::managed_frame::pane_maximize ( const std::string &  pane)

Maximizes the managed pane.

Returns false if pane is not managed.

◆ pane_restore()

bool wex::managed_frame::pane_restore ( const std::string &  pane)

Restores the managed pane.

Returns false if pane is not managed.

◆ pane_set()

bool wex::managed_frame::pane_set ( const std::string &  pane,
const wxAuiPaneInfo &  info 
)

Updates pane info for managed pane.

Returns false if pane is not managed.

◆ pane_show()

bool wex::managed_frame::pane_show ( const std::string &  pane,
bool  show = true 
)

Shows or hides the managed pane.

Returns false if pane is not managed.

◆ pane_toggle()

bool wex::managed_frame::pane_toggle ( const std::string &  pane)
inline

Toggles the managed pane: if shown hides it, otherwise shows it.

Returns false if pane is not managed.

◆ print_ex()

virtual void wex::managed_frame::print_ex ( ex ex,
const std::string &  text 
)
virtual

Prints text in ex dialog.

Parameters
exthe ex for the dialog
textthe text to be printed

◆ record()

virtual void wex::managed_frame::record ( const std::string &  command)
inlinevirtual

Allows you to perform action for a (vi) command.

This method is invoked after command is executed.

◆ restore_page()

virtual stc* wex::managed_frame::restore_page ( const std::string &  key)
inlinevirtual

Restores a previous saved current page.

Returns restored page (default returns nullptr).

◆ show_ex_bar()

void wex::managed_frame::show_ex_bar ( int  action = HIDE_BAR_FOCUS_STC,
ex ex = nullptr 
)

Shows or hides the ex bar.

Default it hides the ex bar and sets focus back to stc component associated with current ex. If current ex has ex mode enabled, the ex bar is always shown.

Parameters
actionaction
excomponent to use for showing ex bar (for SHOW_ actions)

◆ show_ex_command()

bool wex::managed_frame::show_ex_command ( ex ex,
const std::string &  label 
)

Returns a command line ex command.

Shows the ex bar, sets the label and sets focus to it, allowing you to enter a command. Returns false if label is not supported.

Parameters
exthe ex on which command is to be done
labellabel for the ex bar (/, ?, :, =)

◆ show_ex_input()

bool wex::managed_frame::show_ex_input ( ex ex,
char  command 
)

Shows ex bar, and enters input mode.

Returns false if command is not supported.

Parameters
exthe ex on which command is to be done
commandthe command (a, c, or i)

◆ sync_all()

virtual void wex::managed_frame::sync_all ( )
virtual

Called after you checked the Sync checkbox on the options toolbar.

Default syncs current stc.

◆ sync_close_all()

virtual void wex::managed_frame::sync_close_all ( wxWindowID  id)
virtual

Called after all pages from the notebooks are deleted.

Default resets the find focus.