gtksourceviewmm  3.2.0
Public Member Functions | Static Public Attributes | Protected Member Functions | Related Functions
Gsv::View Class Reference

The view object. More...

#include <gtksourceviewmm/view.h>

Inherits TextView.

List of all members.

Public Member Functions

GtkSourceView* gobj ()
 Provides access to the underlying C GtkObject.
const GtkSourceView* gobj () const
 Provides access to the underlying C GtkObject.
 View ()
 Creates a new View.
 View (const Glib::RefPtr< Buffer >& buffer)
 Creates a new View widget displaying the buffer buffer.
Glib::RefPtr< const Bufferget_source_buffer () const
 Returns the GtkTextBuffer being displayed by this text view.
Glib::RefPtr< Bufferget_source_buffer ()
 Returns the GtkTextBuffer being displayed by this text view.
void set_source_buffer (const Glib::RefPtr< Buffer >& source_buffer)
 Sets a source_buffer as the buffer being displayed by source view.
void set_show_line_numbers (bool show=true)
 If true line numbers will be displayed beside the text.
bool get_show_line_numbers () const
 Returns whether line numbers are displayed beside the text.
void set_tab_width (guint width)
 Sets the width of tabulation in characters.
guint get_tab_width () const
 Returns the width of tabulation in characters.
void set_auto_indent (bool enable=true)
 If true auto indentation of text is enabled.
bool get_auto_indent () const
 Returns whether auto indentation of text is enabled.
void set_insert_spaces_instead_of_tabs (bool enable=true)
 If true any tabulator character inserted is replaced by a group of space characters.
bool get_insert_spaces_instead_of_tabs () const
 Returns whether when inserting a tabulator character it should be replaced by a group of space characters.
void set_show_right_margin (bool show=true)
 If true a right margin is displayed.
bool get_show_right_margin () const
 Returns whether a right margin is displayed.
void set_highlight_current_line (bool highlight=true)
 If highlight is true the current line is highlighted.
bool get_highlight_current_line () const
 Returns whether the current line is highlighted.
void set_right_margin_position (guint margin)
 Sets the position of the right margin.
guint get_right_margin_position () const
 Gets the position of the right margin.
void set_smart_home_end (SmartHomeEndType smart_he)
 Set the desired movement of the cursor when HOME and END keys are pressed.
SmartHomeEndType get_smart_home_end () const
 Returns a SmartHomeEndType end value specifying how the cursor will move when HOME and END keys are pressed.
void set_show_line_marks (bool show=true)
 If true line marks will be displayed beside the text.
bool get_show_line_marks () const
 Returns whether line marks are displayed beside the text.
void set_indent_on_tab (bool enable=true)
 If true, when the tab key is pressed and there is a selection, the selected text is indented of one level instead of being replaced with the \t characters.
bool get_indent_on_tab () const
 Returns whether when the tab key is pressed the current selection should get indented instead of replaced with the \t character.
void set_indent_width (gint width)
 Sets the number of spaces to use for each step of indent.
gint get_indent_width () const
 Returns the number of spaces to use for each step of indent.
void set_draw_spaces (DrawSpacesFlags flags=DRAW_SPACES_ALL)
 Set if and how the spaces should be visualized.
DrawSpacesFlags get_draw_spaces () const
 Returns the DrawSpacesFlags specifying if and how spaces should be displayed.
guint get_visual_column (const Gtk::TextIter& iter) const
 Determines the visual column at iter taking into consideration the indent width of view.
Glib::RefPtr< Gutterget_gutter (Gtk::TextWindowType window_type)
 Returns the Gutter object associated with window_type for this view.
Glib::RefPtr< const Gutterget_gutter (Gtk::TextWindowType window_type) const
 Returns the Gutter object associated with window_type for this view.
Glib::RefPtr< Completionget_completion ()
 Gets the Completion associated with this view.
Glib::RefPtr< const Completionget_completion () const
 Gets the Completion associated with this view.
void set_mark_attributes (const Glib::ustring& category, const Glib::RefPtr< MarkAttributes >& attributes, int priority)
 Sets attributes and priority for the category.
Glib::RefPtr< MarkAttributes > get_mark_attributes (const Glib::ustring& category, int& priority)
 Gets attributes and priority for the category.
Glib::RefPtr< const
MarkAttributes > 
get_mark_attributes (const Glib::ustring& category, int& priority) const
 Gets attributes and priority for the category.
Glib::SignalProxy0< void > signal_redo ()
 Emitted when redo action is requested.
Glib::SignalProxy0< void > signal_undo ()
 Emitted when undo action is requested.
Glib::SignalProxy2< void,
Gtk::TextIter&, GdkEvent* > 
signal_line_mark_activated ()
 Emitted when a line mark has been activated (for instance when there was a button press in the line marks gutter).
Glib::SignalProxy2< void,
Gtk::TextIter&, int > 
signal_smart_home_end ()
 Emitted when a the cursor was moved according to the smart home end setting.
Glib::PropertyProxy< bool > property_show_line_numbers ()
 Whether to display line numbers.
Glib::PropertyProxy_ReadOnly
< bool > 
property_show_line_numbers () const
 Whether to display line numbers.
Glib::PropertyProxy< bool > property_show_line_marks ()
 Whether to display line mark pixbufs.
Glib::PropertyProxy_ReadOnly
< bool > 
property_show_line_marks () const
 Whether to display line mark pixbufs.
Glib::PropertyProxy< guint > property_tab_width ()
 Width of a tab character expressed in spaces.
Glib::PropertyProxy_ReadOnly
< guint > 
property_tab_width () const
 Width of a tab character expressed in spaces.
Glib::PropertyProxy< int > property_indent_width ()
 Number of spaces to use for each step of indent.
Glib::PropertyProxy_ReadOnly< int > property_indent_width () const
 Number of spaces to use for each step of indent.
Glib::PropertyProxy< bool > property_auto_indent ()
 Whether to enable auto indentation.
Glib::PropertyProxy_ReadOnly
< bool > 
property_auto_indent () const
 Whether to enable auto indentation.
Glib::PropertyProxy< bool > property_insert_spaces_instead_of_tabs ()
 Whether to insert spaces instead of tabs.
Glib::PropertyProxy_ReadOnly
< bool > 
property_insert_spaces_instead_of_tabs () const
 Whether to insert spaces instead of tabs.
Glib::PropertyProxy< bool > property_show_right_margin ()
 Whether to display the right margin.
Glib::PropertyProxy_ReadOnly
< bool > 
property_show_right_margin () const
 Whether to display the right margin.
Glib::PropertyProxy< guint > property_right_margin_position ()
 Position of the right margin.
Glib::PropertyProxy_ReadOnly
< guint > 
property_right_margin_position () const
 Position of the right margin.
Glib::PropertyProxy
< SmartHomeEndType
property_smart_home_end ()
 HOME and END keys move to first/last non whitespace characters on line before going to the start/end of the line.
Glib::PropertyProxy_ReadOnly
< SmartHomeEndType
property_smart_home_end () const
 HOME and END keys move to first/last non whitespace characters on line before going to the start/end of the line.
Glib::PropertyProxy< bool > property_highlight_current_line ()
 Whether to highlight the current line.
Glib::PropertyProxy_ReadOnly
< bool > 
property_highlight_current_line () const
 Whether to highlight the current line.
Glib::PropertyProxy< bool > property_indent_on_tab ()
 Whether to indent the selected text when the tab key is pressed.
Glib::PropertyProxy_ReadOnly
< bool > 
property_indent_on_tab () const
 Whether to indent the selected text when the tab key is pressed.
Glib::PropertyProxy
< DrawSpacesFlags
property_draw_spaces ()
 Set if and how the spaces should be visualized.
Glib::PropertyProxy_ReadOnly
< DrawSpacesFlags
property_draw_spaces () const
 Set if and how the spaces should be visualized.
Glib::PropertyProxy_ReadOnly
< Glib::RefPtr< Completion > > 
property_completion () const
 The completion object associated with the view.

Static Public Attributes

static const int gutter_position_lines = -30
 The gutter position of the lines renderer.
static const int gutter_position_marks = -20
 The gutter position of the marks renderer.

Protected Member Functions

virtual void on_redo ()
 This is a default handler for the signal signal_redo().
virtual void on_undo ()
 This is a default handler for the signal signal_undo().
virtual void on_line_mark_activated (Gtk::TextIter& mark, GdkEvent* event)
 This is a default handler for the signal signal_line_mark_activated().

Related Functions

(Note that these are not member functions.)

Gsv::Viewwrap (GtkSourceView* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

The view object.

View is the main object of the gtksourceviewmm library. It provides a text view which has syntax highlighting, undo/redo and text marks. Use a Buffer to display text with a GtkSourceView.


Constructor & Destructor Documentation

Gsv::View::View ( ) [explicit]

Creates a new View.

An empty default buffer will be created for you. If you want to specify your own buffer, consider the other constructor.

Returns:
A new View.
Gsv::View::View ( const Glib::RefPtr< Buffer >&  buffer) [explicit]

Creates a new View widget displaying the buffer buffer.

One buffer can be shared among many widgets.

Parameters:
bufferA Buffer.
Returns:
: A new View.

Member Function Documentation

Returns whether auto indentation of text is enabled.

Returns:
true if auto indentation is enabled.

Gets the Completion associated with this view.

Returns:
The Completion associated with this view.
Since gtksourceviewmm 2.10:
Glib::RefPtr<const Completion> Gsv::View::get_completion ( ) const

Gets the Completion associated with this view.

Returns:
The Completion associated with this view.
Since gtksourceviewmm 2.10:

Returns the DrawSpacesFlags specifying if and how spaces should be displayed.

Returns:
The DrawSpacesFlags, 0 if no spaces should be drawn.
Glib::RefPtr<Gutter> Gsv::View::get_gutter ( Gtk::TextWindowType  window_type)

Returns the Gutter object associated with window_type for this view.

Only Gtk::TEXT_WINDOW_LEFT and Gtk::TEXT_WINDOW_RIGHT are supported, respectively corresponding to the left and right gutter. The line numbers and mark category icons are rendered in the gutter corresponding to Gtk::TEXT_WINDOW_LEFT.

Parameters:
window_typeThe gutter window type
Returns:
The Gutter.
Since gtksourceviewmm 2.10:
Glib::RefPtr<const Gutter> Gsv::View::get_gutter ( Gtk::TextWindowType  window_type) const

Returns the Gutter object associated with window_type for this view.

Only Gtk::TEXT_WINDOW_LEFT and Gtk::TEXT_WINDOW_RIGHT are supported, respectively corresponding to the left and right gutter. The line numbers and mark category icons are rendered in the gutter corresponding to Gtk::TEXT_WINDOW_LEFT.

Parameters:
window_typeThe gutter window type
Returns:
The Gutter.
Since gtksourceviewmm 2.10:

Returns whether the current line is highlighted.

Returns:
true if the current line is highlighted.

Returns whether when the tab key is pressed the current selection should get indented instead of replaced with the \t character.

Returns:
true if the selection is indented when tab is pressed.
Since gtksourceviewmm 2.2:

Returns the number of spaces to use for each step of indent.

See set_indent_width() for details.

Returns:
Indent width.

Returns whether when inserting a tabulator character it should be replaced by a group of space characters.

Returns:
true if spaces are inserted instead of tabs.
Glib::RefPtr<MarkAttributes> Gsv::View::get_mark_attributes ( const Glib::ustring &  category,
int &  priority 
)

Gets attributes and priority for the category.

Parameters:
categoryThe category.
priorityPlace where priority of the category will be stored.
Returns:
Gtk::SourceMarkAttributes for the category. The object belongs to view, so it must not be unreffed.
Glib::RefPtr<const MarkAttributes> Gsv::View::get_mark_attributes ( const Glib::ustring &  category,
int &  priority 
) const

Gets attributes and priority for the category.

Parameters:
categoryThe category.
priorityPlace where priority of the category will be stored.
Returns:
Gtk::SourceMarkAttributes for the category. The object belongs to view, so it must not be unreffed.

Gets the position of the right margin.

Returns:
The position of the right margin.

Returns whether line marks are displayed beside the text.

Returns:
true if the line marks are displayed.
Since gtksourceviewmm 2.2:

Returns whether line numbers are displayed beside the text.

Returns:
true if the line numbers are displayed.

Returns whether a right margin is displayed.

Returns:
true if the right margin is shown.

Returns a SmartHomeEndType end value specifying how the cursor will move when HOME and END keys are pressed.

Returns:
A SmartHomeEndType value.
Glib::RefPtr<const Buffer> Gsv::View::get_source_buffer ( ) const

Returns the GtkTextBuffer being displayed by this text view.

Returns:
A Buffer.

Returns the GtkTextBuffer being displayed by this text view.

Returns:
A Buffer.
guint Gsv::View::get_tab_width ( ) const

Returns the width of tabulation in characters.

Returns:
Width of tab.
guint Gsv::View::get_visual_column ( const Gtk::TextIter &  iter) const

Determines the visual column at iter taking into consideration the indent width of view.

Parameters:
iter,:a position in this view.
Returns:
the visual column at iter.
Since gtksourceviewmm 3.0:
Glib::PropertyProxy< bool > Gsv::View::property_auto_indent ( )

Whether to enable auto indentation.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gsv::View::property_auto_indent ( ) const

Whether to enable auto indentation.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Completion> > Gsv::View::property_completion ( ) const

The completion object associated with the view.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Set if and how the spaces should be visualized.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< DrawSpacesFlags > Gsv::View::property_draw_spaces ( ) const

Set if and how the spaces should be visualized.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< bool > Gsv::View::property_highlight_current_line ( )

Whether to highlight the current line.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gsv::View::property_highlight_current_line ( ) const

Whether to highlight the current line.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< bool > Gsv::View::property_indent_on_tab ( )

Whether to indent the selected text when the tab key is pressed.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gsv::View::property_indent_on_tab ( ) const

Whether to indent the selected text when the tab key is pressed.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< int > Gsv::View::property_indent_width ( )

Number of spaces to use for each step of indent.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< int > Gsv::View::property_indent_width ( ) const

Number of spaces to use for each step of indent.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< bool > Gsv::View::property_insert_spaces_instead_of_tabs ( )

Whether to insert spaces instead of tabs.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gsv::View::property_insert_spaces_instead_of_tabs ( ) const

Whether to insert spaces instead of tabs.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< guint > Gsv::View::property_right_margin_position ( )

Position of the right margin.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< guint > Gsv::View::property_right_margin_position ( ) const

Position of the right margin.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< bool > Gsv::View::property_show_line_marks ( )

Whether to display line mark pixbufs.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gsv::View::property_show_line_marks ( ) const

Whether to display line mark pixbufs.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< bool > Gsv::View::property_show_line_numbers ( )

Whether to display line numbers.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gsv::View::property_show_line_numbers ( ) const

Whether to display line numbers.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< bool > Gsv::View::property_show_right_margin ( )

Whether to display the right margin.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< bool > Gsv::View::property_show_right_margin ( ) const

Whether to display the right margin.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

HOME and END keys move to first/last non whitespace characters on line before going to the start/end of the line.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< SmartHomeEndType > Gsv::View::property_smart_home_end ( ) const

HOME and END keys move to first/last non whitespace characters on line before going to the start/end of the line.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< guint > Gsv::View::property_tab_width ( )

Width of a tab character expressed in spaces.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< guint > Gsv::View::property_tab_width ( ) const

Width of a tab character expressed in spaces.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
void Gsv::View::set_auto_indent ( bool  enable = true)

If true auto indentation of text is enabled.

Parameters:
enableWhether to enable auto indentation.
void Gsv::View::set_draw_spaces ( DrawSpacesFlags  flags = DRAW_SPACES_ALL)

Set if and how the spaces should be visualized.

Specifying flags as 0 will disable display of spaces.

Parameters:
flagsDrawSpacesFlags specifing how white spaces should be displayed.
void Gsv::View::set_highlight_current_line ( bool  highlight = true)

If highlight is true the current line is highlighted.

Parameters:
highlightWhether to highlight the current line.
void Gsv::View::set_indent_on_tab ( bool  enable = true)

If true, when the tab key is pressed and there is a selection, the selected text is indented of one level instead of being replaced with the \t characters.

Shift+Tab unindents the selection.

Parameters:
enableWhether to indent a block when tab is pressed.
Since gtksourceviewmm 2.2:
void Gsv::View::set_indent_width ( gint  width)

Sets the number of spaces to use for each step of indent.

If width is -1, the value of the View::property_tab_width property will be used.

Parameters:
widthIndent width in characters.
void Gsv::View::set_insert_spaces_instead_of_tabs ( bool  enable = true)

If true any tabulator character inserted is replaced by a group of space characters.

Parameters:
enableWhether to insert spaces instead of tabs.
void Gsv::View::set_mark_attributes ( const Glib::ustring &  category,
const Glib::RefPtr< MarkAttributes > &  attributes,
int  priority 
)

Sets attributes and priority for the category.

Parameters:
categoryThe category.
attributesMark attributes.
priorityPriority of the category.
void Gsv::View::set_right_margin_position ( guint  margin)

Sets the position of the right margin.

Parameters:
marginThe width in characters where to position the right margin.
void Gsv::View::set_show_line_marks ( bool  show = true)

If true line marks will be displayed beside the text.

Parameters:
showWhether line marks should be displayed.
Since gtksourceviewmm 2.2:
void Gsv::View::set_show_line_numbers ( bool  show = true)

If true line numbers will be displayed beside the text.

Parameters:
showWhether line numbers should be displayed.
void Gsv::View::set_show_right_margin ( bool  show = true)

If true a right margin is displayed.

Parameters:
showWhether to show a right margin.

Set the desired movement of the cursor when HOME and END keys are pressed.

Parameters:
smart_heThe desired behavior among SmartHomeEndType.
void Gsv::View::set_source_buffer ( const Glib::RefPtr< Buffer >&  source_buffer)

Sets a source_buffer as the buffer being displayed by source view.

The previous buffer displayed by the text view is unreferenced, and a reference is added to buffer.

Parameters:
source_bufferA Buffer.
void Gsv::View::set_tab_width ( guint  width)

Sets the width of tabulation in characters.

Parameters:
widthWidth of tab in characters.
Glib::SignalProxy2< void,Gtk::TextIter&,GdkEvent* > Gsv::View::signal_line_mark_activated ( )

Emitted when a line mark has been activated (for instance when there was a button press in the line marks gutter).

You can use iter to determine on which line the activation took place.

Handler parameters:
iter A Gtk::TextIter. event The GdkEvent that activated the event.
Slot Prototype:
void on_my_line_mark_activated(Gtk::TextIter& mark, GdkEvent* event)
Glib::SignalProxy0< void > Gsv::View::signal_redo ( )

Emitted when redo action is requested.

Slot Prototype:
void on_my_redo()
Glib::SignalProxy2< void,Gtk::TextIter&,int > Gsv::View::signal_smart_home_end ( )

Emitted when a the cursor was moved according to the smart home end setting.

The signal is emitted after the cursor is moved, but during the Gtk::TextView::move-cursor action. This can be used to find out whether the cursor was moved by a normal home/end or by a smart home/end.

Handler parameters:
iter A Gtk::TextIter count The count
Since gtksourceviewmm 3.0:
Slot Prototype:
void on_my_smart_home_end(Gtk::TextIter& iter, int count)
Glib::SignalProxy0< void > Gsv::View::signal_undo ( )

Emitted when undo action is requested.

Slot Prototype:
void on_my_undo()

Friends And Related Function Documentation

Gsv::View* wrap ( GtkSourceView *  object,
bool  take_copy = false 
) [related]

A Glib::wrap() method for this object.

Parameters:
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns:
A C++ instance that wraps this C instance.