wex  v20.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/managedframe.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 }
 Enums for hide_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 window_data &data=window_data().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 stc_data &data=stc_data()) override
 overriden 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.
 
bool add_panes (const panes_t &panes, const std::string &perspective="managed frame")
 Other methods. More...
 
auto & file_history ()
 Returns file history.
 
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.
 
void hide_ex_bar (int hide=HIDE_BAR_FOCUS_STC)
 Hides the ex bar. More...
 
auto & manager ()
 Returns the manager.
 
bool show_ex_command (ex *ex, const std::string &label)
 Returns a command line ex command. More...
 
void show_ex_message (const std::string &text)
 Shows text in ex bar.
 
bool show_pane (const std::string &pane, bool show=true)
 Shows or hides the managed pane. More...
 
bool toggle_pane (const std::string &pane)
 Toggles the managed pane: if shown hides it, otherwise shows it. More...
 
const auto & toggled_panes () const
 Returns the toggled panes.
 
- Public Member Functions inherited from wex::frame
 frame (const window_data &data=window_data())
 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 stc_data &data=stc_data())
 Allows you to open a filename with info from vcs. More...
 
virtual stcopen_file (const path &filename, const std::string &text, const stc_data &data=stc_data())
 Allows you to open a filename with specified contents. More...
 
void set_find_focus (wxWindow *focus)
 Other methods. More...
 
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.
 

Additional Inherited Members

- Static Public Member Functions inherited from wex::frame
static std::string get_statustext (const std::string &pane)
 Static interface. More...
 
static bool is_closing ()
 Are we closing?
 
static bool statustext (const std::string &text, const std::string &pane)
 Sets text on specified pane. More...
 
static bool update_statusbar (const wxListView *lv)
 Updates statusbar pane items pane with values from specified listview.
 
static 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 hide_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

Member Function Documentation

◆ add_panes()

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

Other methods.

Add panes to manager.

Parameters
panespanes
perspectivename of perspective to load / save

◆ 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.

◆ hide_ex_bar()

void wex::managed_frame::hide_ex_bar ( int  hide = HIDE_BAR_FOCUS_STC)

Hides the ex bar.

Default it sets focus back to stc component associated with current ex.

◆ 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.

◆ 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_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_pane()

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

Shows or hides the managed pane.

Returns false if pane is not managed.

◆ 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.

◆ toggle_pane()

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

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

Returns false if pane is not managed.