wex v24.04.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/ui/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)
 Returns true if the page can be closed.
 
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, syntax::stc *stc)
 Runs debug action.
 
virtual void debug_exe (const std::string &command, syntax::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, syntax::stc *stc)
 Toggles a breakpoint on line.
 
virtual bool exec_ex_command (ex_command &command)
 Executes a ex command.
 
virtual bool is_address (syntax::stc *stc, const std::string &text)
 Allows you to override is_address, it is overridden in del frame, returning true if text specifies a one or two address based ex address (including command).
 
virtual bool next_page ()
 Moves to next page. If none or only one page present, returns false.
 
virtual void on_notebook (wxWindowID id, wxWindow *page)
 Called if the notebook changed page.
 
virtual void open_file_same_page (const wex::path &p)
 Called on browse forward, backward.
 
virtual bool print_ex (syntax::stc *stc, const std::string &text)
 Allows you to override print ex.
 
virtual void record (const std::string &command)
 Allows you to perform action for a (vi) command.
 
virtual syntax::stcrestore_page (const std::string &key)
 Restores a previous saved current page.
 
virtual bool save_current_page (const std::string &key)
 Saves the current page, to restore later on.
 
virtual void shift_double_click ()
 Act on a double shift click.
 
virtual void show_ex_bar (int action=HIDE_BAR_FOCUS_STC, syntax::stc *stc=nullptr)
 Shows or hides the ex bar.
 
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 syntax::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 validator.
 
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.
 
virtual void vcs_add_path (factory::link *l)
 Adds vcs path.
 
virtual bool vcs_annotate_commit (syntax::stc *, int line, const std::string &commit_id)
 Annotates commit.
 
virtual bool vcs_blame (syntax::stc *)
 Blames the specified stc.
 
virtual bool vcs_blame_revision (syntax::stc *, const std::string &renamed, const std::string &offset)
 Blames revision.
 
virtual bool vcs_dir_exists (const path &p) const
 Returns true if dir exists.
 
virtual bool vcs_execute (int event_id, const std::vector< wex::path > &paths, const data::window &arg=data::window())
 Executes vcs.
 
bool allow_browse_backward () const
 Can we browse backward?
 
bool allow_browse_forward () const
 Can we browse forward?
 
bool browse (const wxCommandEvent &event)
 Handles forward and backward click.
 
const auto * debug_entry () const
 Returns current debugger.
 
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.
 
bool pane_add (const panes_t &panes, const std::string &perspective="managed frame")
 Add panes to the manager.
 
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.
 
bool pane_restore (const std::string &pane)
 Restores the managed pane.
 
bool pane_set (const std::string &pane, const wxAuiPaneInfo &info)
 Updates pane info for managed pane.
 
bool pane_show (const std::string &pane, bool show=true)
 Shows or hides the managed pane.
 
bool pane_toggle (const std::string &pane)
 Toggles the managed pane: if shown hides it, otherwise shows it.
 
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.
 
bool show_ex_command (syntax::stc *stc, const std::string &label)
 Returns a command line ex command.
 
bool show_ex_input (syntax::stc *stc, char command)
 Shows ex bar, and enters input mode.
 
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.
 
bool output (const std::string &text) const override
 Allows you to handle output text, .e.g. from a process.
 
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.
 
- Public Member Functions inherited from wex::factory::frame
 frame ()
 Default constructor.
 
 frame (wxWindow *parent, wxWindowID winid, const std::string &title)
 Constructor for wxFrame.
 
virtual factory::gridget_grid ()
 Returns a grid.
 
virtual factory::listviewget_listview ()
 Returns a listview.
 
virtual factory::processget_process (const std::string &command)
 Allows you to e.g.
 
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.
 
virtual factory::stcopen_file_vcs (const path &filename, vcs_entry &vcs, const data::stc &data)
 Allows you to open a filename with info from vcs.
 
virtual bool process_async_system (const process_data &data)
 Runs async process.
 
virtual void statusbar_clicked (const std::string &pane)
 When (left) clicked, uses the get_stc() for some dialogs.
 
wxWindow * get_find_focus ()
 Returns the find focus.
 
bool is_closing () const
 Are we closing?
 
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

Returns true if the page can be closed.

Default resets the find focus.

Parameters
idnotebook id
pagepage

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

◆ is_address()

virtual bool wex::frame::is_address ( syntax::stc * stc,
const std::string & text )
inlinevirtual

Allows you to override is_address, it is overridden in del frame, returning true if text specifies a one or two address based ex address (including command).

e.g. 1,5y, y, etc.

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)
virtual

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

This method is invoked after command is executed.

◆ restore_page()

virtual syntax::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,
syntax::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 ( syntax::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 ( syntax::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.

◆ vcs_execute()

virtual bool wex::frame::vcs_execute ( int event_id,
const std::vector< wex::path > & paths,
const data::window & arg = data::window() )
inlinevirtual

Executes vcs.

Parameters
event_idthe vcs id
pathsthe paths
argwindow data

Reimplemented in wex::del::frame.