#include <wx/caret.h>
A caret is a blinking cursor showing the position where the typed text will appear.
Text controls usually have their own caret but wxCaret provides a way to use a caret in other windows.
Currently, the caret appears as a rectangle of the given size. In the future, it will be possible to specify a bitmap to be used for the caret shape.
A caret is always associated with a window and the current caret can be retrieved using wxWindow::GetCaret(). The same caret can't be reused in two different windows.
Public Member Functions | |
wxCaret () | |
Default constructor. | |
wxWindow * | GetWindow () const |
Get the window the caret is associated with. | |
virtual void | Hide () |
Hides the caret, same as Show(false). | |
bool | IsOk () const |
Returns true if the caret was created successfully. | |
bool | IsVisible () const |
Returns true if the caret is visible and false if it is permanently hidden (if it is blinking and not shown currently but will be after the next blink, this method still returns true). | |
virtual void | Show (bool show=true) |
Shows or hides the caret. | |
wxCaret (wxWindow *window, int width, int height) | |
Creates a caret with the given size (in pixels) and associates it with the window. | |
wxCaret (wxWindow *window, const wxSize &size) | |
Creates a caret with the given size (in pixels) and associates it with the window. | |
bool | Create (wxWindow *window, int width, int height) |
Creates a caret with the given size (in pixels) and associates it with the window (same as the equivalent constructors). | |
bool | Create (wxWindow *window, const wxSize &size) |
Creates a caret with the given size (in pixels) and associates it with the window (same as the equivalent constructors). | |
void | GetPosition (int *x, int *y) const |
Get the caret position (in pixels). | |
wxPoint | GetPosition () const |
Get the caret position (in pixels). | |
void | GetSize (int *width, int *height) const |
Get the caret size. | |
wxSize | GetSize () const |
Get the caret size. | |
void | Move (int x, int y) |
Move the caret to given position (in logical coordinates). | |
void | Move (const wxPoint &pt) |
Move the caret to given position (in logical coordinates). | |
void | SetSize (int width, int height) |
Changes the size of the caret. | |
void | SetSize (const wxSize &size) |
Changes the size of the caret. | |
Static Public Member Functions | |
static int | GetBlinkTime () |
Returns the blink time which is measured in milliseconds and is the time elapsed between 2 inversions of the caret (blink time of the caret is the same for all carets, so this functions is static). | |
static void | SetBlinkTime (int milliseconds) |
Sets the blink time for all the carets. | |
wxCaret::wxCaret | ( | ) |
Default constructor.
wxCaret::wxCaret | ( | wxWindow * | window, |
int | width, | ||
int | height | ||
) |
Creates a caret with the given size (in pixels) and associates it with the window.
Creates a caret with the given size (in pixels) and associates it with the window.
bool wxCaret::Create | ( | wxWindow * | window, |
int | width, | ||
int | height | ||
) |
Creates a caret with the given size (in pixels) and associates it with the window (same as the equivalent constructors).
Creates a caret with the given size (in pixels) and associates it with the window (same as the equivalent constructors).
|
static |
Returns the blink time which is measured in milliseconds and is the time elapsed between 2 inversions of the caret (blink time of the caret is the same for all carets, so this functions is static).
void wxCaret::GetPosition | ( | int * | x, |
int * | y | ||
) | const |
Get the caret position (in pixels).
wxPerl Note: In wxPerl there are two methods instead of a single overloaded method:
wxPoint wxCaret::GetPosition | ( | ) | const |
Get the caret position (in pixels).
wxPerl Note: In wxPerl there are two methods instead of a single overloaded method:
void wxCaret::GetSize | ( | int * | width, |
int * | height | ||
) | const |
Get the caret size.
wxPerl Note: In wxPerl there are two methods instead of a single overloaded method:
wxSize wxCaret::GetSize | ( | ) | const |
Get the caret size.
wxPerl Note: In wxPerl there are two methods instead of a single overloaded method:
wxWindow* wxCaret::GetWindow | ( | ) | const |
Get the window the caret is associated with.
|
virtual |
Hides the caret, same as Show(false).
bool wxCaret::IsOk | ( | ) | const |
Returns true if the caret was created successfully.
bool wxCaret::IsVisible | ( | ) | const |
Returns true if the caret is visible and false if it is permanently hidden (if it is blinking and not shown currently but will be after the next blink, this method still returns true).
void wxCaret::Move | ( | int | x, |
int | y | ||
) |
Move the caret to given position (in logical coordinates).
void wxCaret::Move | ( | const wxPoint & | pt | ) |
Move the caret to given position (in logical coordinates).
|
static |
Sets the blink time for all the carets.
void wxCaret::SetSize | ( | int | width, |
int | height | ||
) |
Changes the size of the caret.
void wxCaret::SetSize | ( | const wxSize & | size | ) |
Changes the size of the caret.
|
virtual |
Shows or hides the caret.
Notice that if the caret was hidden N times, it must be shown N times as well to reappear on the screen.