Class GtkSource
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Like gtk_source_get_major_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.static final int
Like gtk_source_get_micro_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.static final int
Like gtk_source_get_minor_version(), but from the headers used at application compile time, rather than from the library linked against at application run time. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
checkVersion
(int major, int minor, int micro) Like GTK_SOURCE_CHECK_VERSION, but the check for gtk_source_check_version is at runtime instead of compile time.static void
Free the resources allocated by GtkSourceView.static int
Returns the major version number of the GtkSourceView library.static int
Returns the micro version number of the GtkSourceView library.static int
Returns the minor version number of the GtkSourceView library.static void
init()
Initializes the GtkSourceView library (e.g.static void
static long
schedulerAdd
(SchedulerCallback callback) Simplified version ofschedulerAddFull(org.gnome.gtksourceview.SchedulerCallback)
.static long
schedulerAddFull
(SchedulerCallback callback) Adds a new callback that will be executed as time permits on the main thread.static void
schedulerRemove
(long handlerId) Removes a scheduler callback previously registered withschedulerAdd(org.gnome.gtksourceview.SchedulerCallback)
orschedulerAddFull(org.gnome.gtksourceview.SchedulerCallback)
.static String
utilsEscapeSearchText
(String text) Use this function to escape the following characters:\\n
,\\r
,\\t
and\\
.static String
Use this function beforeSearchSettings.setSearchText(java.lang.String)
, to unescape the following sequences of characters:\\n
,\\r
,\\t
and\\\\
.
-
Field Details
-
MAJOR_VERSION
public static final int MAJOR_VERSIONLike gtk_source_get_major_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.- See Also:
-
MICRO_VERSION
public static final int MICRO_VERSIONLike gtk_source_get_micro_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.- See Also:
-
MINOR_VERSION
public static final int MINOR_VERSIONLike gtk_source_get_minor_version(), but from the headers used at application compile time, rather than from the library linked against at application run time.- See Also:
-
-
Constructor Details
-
GtkSource
public GtkSource()
-
-
Method Details
-
javagi$ensureInitialized
public static void javagi$ensureInitialized() -
checkVersion
public static boolean checkVersion(int major, int minor, int micro) Like GTK_SOURCE_CHECK_VERSION, but the check for gtk_source_check_version is at runtime instead of compile time. This is useful for compiling against older versions of GtkSourceView, but using features from newer versions.- Parameters:
major
- the major version to checkminor
- the minor version to checkmicro
- the micro version to check- Returns:
true
if the version of the GtkSourceView currently loaded is the same as or newer than the passed-in version.
-
finalize_
public static void finalize_()Free the resources allocated by GtkSourceView. For example it unrefs the singleton objects.It is not mandatory to call this function, it's just to be friendlier to memory debugging tools. This function is meant to be called at the end of main(). It can be called several times.
-
getMajorVersion
public static int getMajorVersion()Returns the major version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 3.)This function is in the library, so it represents the GtkSourceView library your code is running against. Contrast with the
GTK_SOURCE_MAJOR_VERSION
macro, which represents the major version of the GtkSourceView headers you have included when compiling your code.- Returns:
- the major version number of the GtkSourceView library
-
getMicroVersion
public static int getMicroVersion()Returns the micro version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 0.)This function is in the library, so it represents the GtkSourceView library your code is running against. Contrast with the
GTK_SOURCE_MICRO_VERSION
macro, which represents the micro version of the GtkSourceView headers you have included when compiling your code.- Returns:
- the micro version number of the GtkSourceView library
-
getMinorVersion
public static int getMinorVersion()Returns the minor version number of the GtkSourceView library. (e.g. in GtkSourceView version 3.20.0 this is 20.)This function is in the library, so it represents the GtkSourceView library your code is running against. Contrast with the
GTK_SOURCE_MINOR_VERSION
macro, which represents the minor version of the GtkSourceView headers you have included when compiling your code.- Returns:
- the minor version number of the GtkSourceView library
-
init
public static void init()Initializes the GtkSourceView library (e.g. for the internationalization).This function can be called several times, but is meant to be called at the beginning of main(), before any other GtkSourceView function call.
-
schedulerAdd
Simplified version ofschedulerAddFull(org.gnome.gtksourceview.SchedulerCallback)
.- Parameters:
callback
- the callback to execute
-
schedulerAddFull
Adds a new callback that will be executed as time permits on the main thread.This is useful when you need to do a lot of background work but want to do it incrementally.
callback
will be provided a deadline that it should complete it's work by (or near) and can be checked usingGLib.getMonotonicTime()
for comparison.Use
schedulerRemove(long)
to remove the handler.- Parameters:
callback
- the callback to execute
-
schedulerRemove
public static void schedulerRemove(long handlerId) Removes a scheduler callback previously registered withschedulerAdd(org.gnome.gtksourceview.SchedulerCallback)
orschedulerAddFull(org.gnome.gtksourceview.SchedulerCallback)
.- Parameters:
handlerId
- the handler id
-
utilsEscapeSearchText
Use this function to escape the following characters:\\n
,\\r
,\\t
and\\
.For a regular expression search, use g_regex_escape_string() instead.
One possible use case is to take the
GtkTextBuffer
's selection and put it in a search entry. The selection can contain tabulations, newlines, etc. So it's better to escape those special characters to better fit in the search entry.See also:
utilsUnescapeSearchText(java.lang.String)
.<warning> Warning: the escape and unescape functions are not reciprocal! For example, escape (unescape (\\)) = \\\\. So avoid cycles such as: search entry -> unescape -> search settings -> escape -> search entry. The original search entry text may be modified. </warning>
- Parameters:
text
- the text to escape.- Returns:
- the escaped
text
.
-
utilsUnescapeSearchText
Use this function beforeSearchSettings.setSearchText(java.lang.String)
, to unescape the following sequences of characters:\\n
,\\r
,\\t
and\\\\
. The purpose is to easily write those characters in a search entry.Note that unescaping the search text is not needed for regular expression searches.
See also:
utilsEscapeSearchText(java.lang.String)
.- Parameters:
text
- the text to unescape.- Returns:
- the unescaped
text
.
-