wex v24.10.0
Public Member Functions | List of all members
wex::syntax::stc Class Reference

Offers a factory stc with lexer support (syntax colouring, folding). More...

#include <wex/syntax/stc.h>

Inheritance diagram for wex::syntax::stc:
Inheritance graph
[legend]

Public Member Functions

 stc (const data::window &data=data::window())
 Default constructor.
 
virtual bool lexer_is_previewable () const final
 Returns whether lexer is previewable.
 
virtual std::string lexer_name () const final
 Returns the name of the lexer.
 
void blame_margin (const blame *blame)
 Blames margin.
 
void fold (bool fold_all=false)
 Enables or disables folding depending on fold property (default not implemented).
 
const auto & get_lexer () const
 Returns the lexer.
 
auto & get_lexer ()
 Returns the lexer.
 
std::string margin_get_revision_renamed () const
 Returns renamed revision.
 
bool set_indicator (const indicator &indicator, int start=-1, int end=-1)
 Sets an indicator at specified start and end pos.
 
- Public Member Functions inherited from wex::factory::stc
 stc (const data::window &data=data::window())
 Default constructor.
 
virtual void add_text (const std::string &text)
 Adds text.
 
virtual void add_text_block (const std::string &text)
 Adds text block mode.
 
virtual void append_text (const std::string &text)
 Appends text (to end).
 
virtual bool auto_indentation (int c)
 After pressing enter, starts new line at same place as previous line.
 
virtual wex::data::stcget_data ()
 Returns stc data.
 
virtual const ex_commandget_ex_command () const
 Returns the ex command.
 
virtual const std::string get_find_string () const
 Returns find string, from selected text or from config.
 
virtual bool get_hexmode_erase (int begin, int end)
 Hex erase.
 
virtual bool get_hexmode_insert (const std::string &command, int pos)
 Hex insert.
 
virtual std::string get_hexmode_lines (const std::string &text) const
 Hex lines.
 
virtual bool get_hexmode_replace (char)
 Hex replace.
 
virtual bool get_hexmode_replace_target (const std::string &replacement, bool set_text)
 Hex replace target.
 
virtual bool get_hexmode_sync ()
 Hex sync.
 
virtual bool inject (const data::control &data)
 Injects data.
 
virtual bool is_hexmode () const
 Returns true if we are in hex mode (default false).
 
virtual bool is_visual () const
 Returns true if we are in visual mode (not ex mode) (default true).
 
virtual bool link_open ()
 If selected text is a link, opens the link.
 
virtual bool open (const wex::path &path, const data::stc &data)
 Opens the file, reads the content into the window, then closes the file and sets the lexer.
 
virtual const wex::pathpath () const =0
 Returns the path, as used by the file.
 
virtual void print (bool prompt=true)
 Prints the document.
 
virtual void print_preview (wxPreviewFrameModalityKind kind=wxPreviewFrame_AppModal)
 Shows a print preview.
 
virtual void properties_message (path::log_t flags=path::log_t().set(path::LOG_MOD))
 Shows properties on the statusbar using specified flags.
 
virtual bool set_hexmode (bool on)
 Sets hex mode (default false).
 
virtual void set_search_flags (int flags)
 Sets search flags, default invokes SetSearchFlags.
 
virtual void set_text (const std::string &value)
 Sets the text.
 
virtual void show_ascii_value ()
 Shows decimal or hex info of word under cursor.
 
virtual void show_line_numbers (bool show)
 Shows or hides line numbers.
 
virtual void show_whitespace (bool show)
 Shows or hides whitespace.
 
virtual void sync (bool start=true)
 Starts or stops syncing.
 
virtual void use_modification_markers (bool use)
 Use and show modification markers in the margin.
 
virtual bool vi_command (const line_data &data)
 Runs a vi command on this stc (default false).
 
virtual bool vi_command_finish (bool user_input)
 Finish last vi command (default false).
 
virtual bool vi_is_recording () const
 Returns true if we are recording.
 
virtual bool vi_is_visual () const
 Returns true if we are in vi visual mode (default false).
 
virtual const std::string vi_mode () const
 Returns vi mode as a string.
 
virtual void vi_record (const std::string &command)
 Records a macro.
 
virtual std::string vi_register (char c) const
 Returns vi register.
 
virtual int vi_search_flags () const
 Returns vi search flags.
 
virtual void visual (bool on)
 Sets using visual vi (on) or ex mode (!on).
 
void bind_wx ()
 Binds wx methods.
 
void clear (bool set_savepoint=true)
 Clears the component: all text is cleared and all styles are reset.
 
const std::string eol () const
 Returns EOL string.
 
size_t get_fold_level () const
 Returns current line fold level.
 
int get_margin_text_click () const
 Returns line on which text margin was clicked, or -1 if not.
 
const std::string get_selected_text () const
 Returns selected text as a string.
 
const std::string get_text () const
 Returns the text.
 
const std::string get_word_at_pos (int pos) const
 Returns word at position.
 
std::string margin_get_revision_id () const
 When clicked on a line with a text margin, returns revision id on the text margin, otherwise returns empty string.
 
bool margin_text_is_shown () const
 Returns true if margin text is shown.
 
void margin_text_show ()
 Shows text margin.
 
bool position_restore ()
 Restores saved position.
 
void position_save ()
 Saves position.
 
void reset_margins (margin_t type=margin_t().set())
 Resets (all) margins.
 
void set_margin_text_click (int line)
 Sets the margin line that is clicked (for testing).
 
auto & vcs_renamed () const
 Returns renamed.
 
bool find (const std::string &text, int find_flags=-1, bool find_next=true) override
 Override methods from text_window.
 
int get_current_line () const override
 Returns current line no.
 
int get_line_count () const override
 Returns number of lines.
 
int get_line_count_request () override
 Request for number of lines.
 
void goto_line (int line) override
 Goes to specified line.
 
- Public Member Functions inherited from wex::factory::text_window
virtual ~text_window ()=default
 Destructor.
 

Additional Inherited Members

- Public Types inherited from wex::factory::stc
enum  { MARGIN_DIVIDER = 0 , MARGIN_FOLDING = 1 , MARGIN_LINENUMBER = 2 , MARGIN_TEXT = 3 }
 Margin flags. More...
 
typedef std::bitset< 4 > margin_t
 A typedef containing margin flags.
 

Detailed Description

Offers a factory stc with lexer support (syntax colouring, folding).

Member Function Documentation

◆ fold()

void wex::syntax::stc::fold ( bool fold_all = false)

Enables or disables folding depending on fold property (default not implemented).

Parameters
fold_allif document contains more than 'Auto fold' lines, or if fold_all (and fold property is on) is specified, always all lines are folded.

◆ set_indicator()

bool wex::syntax::stc::set_indicator ( const indicator & indicator,
int start = -1,
int end = -1 )

Sets an indicator at specified start and end pos.

Returns false if indicator is not loaded.

Parameters
indicatorindicator to use
startstart pos, if -1 GetTargetStart is used
endend pos, if -1 GetTargetEnd is used