wex  v21.10.0
Public Types | Public Member Functions | List of all members
wex::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/frame.h>

Inheritance diagram for wex::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

 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.
 
 ~frame () override
 Destructor, uninits the aui manager.
 
virtual bool allow_close (wxWindowID id, wxWindow *page)
 Virtual interface. More...
 
virtual void append_vcs (menu *, const menu_item *i) const
 Appends vcs menu.
 
virtual void bind_accelerators (wxWindow *parent, const std::vector< wxAcceleratorEntry > &v, bool debug=false)
 Binds accelerators.
 
virtual void debug_add_menu (menu &, bool)
 Adds debug menu.
 
virtual void debug_exe (int menu_id, factory::stc *stc)
 Runs debug action.
 
virtual void debug_exe (const std::string &command, factory::stc *stc)
 Runs debug command.
 
virtual void debug_exe (const path &p)
 Invoked when a debug exe path is opened.
 
virtual wxEvtHandler * debug_handler ()
 Sets a debug handler.
 
virtual bool debug_is_active () const
 Runs true if we are debugging.
 
virtual bool debug_print (const std::string &text)
 Prints a debug variable.
 
virtual bool debug_toggle_breakpoint (int line, factory::stc *stc)
 Toggles a breakpoint on line.
 
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 bool print_ex (factory::stc *stc, const std::string &text)
 Allows you to override print ex.
 
virtual bool process_async_system (const std::string &command, const std::string &start_dir=std::string())
 Runs async process.
 
virtual void record (const std::string &command)
 Allows you to perform action for a (vi) command. More...
 
virtual factory::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 show_ex_bar (int action=HIDE_BAR_FOCUS_STC, factory::stc *stc=nullptr)
 Shows or hides the ex bar. More...
 
virtual void show_ex_message (const std::string &text)
 Shows text in ex bar.
 
virtual int show_stc_entry_dialog (bool modal=false)
 Shows or updates stc entry dialog.
 
virtual factory::stcstc_entry_dialog_component ()
 Returns stc component for stc entry dialog.
 
virtual std::string stc_entry_dialog_title () const
 Returns stc entry dialog title.
 
virtual void stc_entry_dialog_title (const std::string &title)
 Sets stc entry dialog title.
 
virtual void stc_entry_dialog_validator (const std::string &regex)
 Sets stc entry dialog vaildator.
 
virtual void sync_all ()
 Called after you checked the Sync checkbox on the options toolbar.
 
virtual void sync_close_all (wxWindowID id)
 Called after all pages from the notebooks are deleted. More...
 
const auto * debug_entry () const
 Other methods. More...
 
auto & file_history ()
 Returns file history.
 
auto * get_find_toolbar ()
 Returns the find toolbar.
 
auto * get_options_toolbar ()
 Returns the options toolbar.
 
auto * get_statusbar ()
 Returns statusbar.
 
auto * get_toolbar ()
 Returns the toolbar.
 
const std::string pane_add (wxWindow *pane)
 Adds a window as a pane, generating a unique name. More...
 
bool pane_add (const panes_t &panes, const std::string &perspective="managed frame")
 Add panes to the manager. More...
 
wxWindow * pane_get (const std::string &pane)
 Returns window related to window, or nullptr if pane is not present.
 
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 set_debug_entry (wex::debug_entry *de)
 Sets debug entry.
 
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 show_ex_command (factory::stc *stc, const std::string &label)
 Returns a command line ex command. More...
 
bool show_ex_input (factory::stc *stc, char command)
 Shows ex bar, and enters input mode. More...
 
void show_process (bool show)
 Shows or hide process pane.
 
const auto & toggled_panes () const
 Returns the toggled panes.
 
std::string get_statustext (const std::string &pane) const override
 overridden methods
 
factory::stcopen_file (const path &filename, const data::stc &data=data::stc()) override
 Default opens the file using get_stc. More...
 
void set_recent_file (const path &path) override
 Allows derived class to update file history.
 
void statusbar_clicked_right (const std::string &) override
 Do something when statusbar is (right) clicked.
 
bool statustext (const std::string &text, const std::string &pane) const override
 Sets text on specified pane. More...
 
- Public Member Functions inherited from wex::factory::frame
virtual factory::gridget_grid ()
 Virtual interface. More...
 
virtual factory::listviewget_listview ()
 Returns a listview.
 
virtual factory::processget_process (const std::string &command)
 Allows you to e.g. More...
 
virtual factory::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 factory::stcopen_file (const path &filename, const std::string &text, const data::stc &data)
 Allows you to open a filename with specified contents. More...
 
virtual factory::stcopen_file (const path &filename, const vcs_entry &vcs, const data::stc &data)
 Allows you to open a filename with info from vcs. More...
 
virtual bool output (const std::string &text) const
 Allows you to handle output text, .e.g. More...
 
virtual void statusbar_clicked (const std::string &pane)
 When (left) clicked, uses the get_stc() for some dialogs.
 
bool is_closing () const
 Other methods. More...
 
void set_find_focus (wxWindow *focus)
 Sets the find focus to specified window.
 
bool update_statusbar (const wxListView *lv)
 Updates statusbar pane items pane with values from specified listview.
 
bool update_statusbar (factory::stc *stc, const std::string &pane)
 Updates the specified statusbar pane with values from specified stc.
 
void SetMenuBar (wxMenuBar *bar) override
 Override from base class.
 

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::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

◆ debug_entry()

const auto* wex::frame::debug_entry ( ) const
inline

Other methods.

Returns current debugger.

◆ exec_ex_command()

virtual bool wex::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.

◆ on_notebook()

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

Called if the notebook changed page.

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

Reimplemented in wex::del::frame.

◆ open_file()

factory::stc* wex::frame::open_file ( const path filename,
const data::stc data = data::stc() 
)
overridevirtual

Default opens the file using get_stc.

Returns stc component opened, or nullptr.

Reimplemented from wex::factory::frame.

◆ pane_add() [1/2]

bool wex::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_add() [2/2]

const std::string wex::frame::pane_add ( wxWindow *  pane)

Adds a window as a pane, generating a unique name.

Return the name of the pane.

◆ pane_maximize()

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

Maximizes the managed pane.

Returns false if pane is not managed.

◆ pane_restore()

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

Restores the managed pane.

Returns false if pane is not managed.

◆ pane_set()

bool wex::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::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::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.

◆ record()

virtual void wex::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 factory::stc* wex::frame::restore_page ( const std::string &  key)
inlinevirtual

Restores a previous saved current page.

Returns restored page (default returns nullptr).

◆ setup_statusbar()

statusbar* wex::frame::setup_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.

And initializes other static data.

◆ show_ex_bar()

virtual void wex::frame::show_ex_bar ( int  action = HIDE_BAR_FOCUS_STC,
factory::stc stc = nullptr 
)
inlinevirtual

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
stcstc component to use for showing ex bar (for SHOW_ actions)

Reimplemented in wex::del::frame.

◆ show_ex_command()

bool wex::frame::show_ex_command ( factory::stc stc,
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
stcthe ex on which command is to be done
labellabel for the ex bar (/, ?, :, =)

◆ show_ex_input()

bool wex::frame::show_ex_input ( factory::stc stc,
char  command 
)

Shows ex bar, and enters input mode.

Returns false if command is not supported.

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

◆ statustext()

bool wex::frame::statustext ( const std::string &  text,
const std::string &  pane 
) const
overridevirtual

Sets text on specified pane.

Don't forget to call setup_statusbar first.

Reimplemented from wex::factory::frame.

◆ sync_close_all()

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

Called after all pages from the notebooks are deleted.

Default resets the find focus.