#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. More... | |
wxWindow * | GetWindow () const |
Get the window the caret is associated with. More... | |
virtual void | Hide () |
Hides the caret, same as Show(false). More... | |
bool | IsOk () const |
Returns true if the caret was created successfully. More... | |
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). More... | |
virtual void | Show (bool show=true) |
Shows or hides the caret. More... | |
wxCaret (wxWindow *window, int width, int height) | |
Creates a caret with the given size (in pixels) and associates it with the window. More... | |
wxCaret (wxWindow *window, const wxSize &size) | |
Creates a caret with the given size (in pixels) and associates it with the window. More... | |
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). More... | |
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). More... | |
void | GetPosition (int *x, int *y) const |
Get the caret position (in pixels). More... | |
wxPoint | GetPosition () const |
Get the caret position (in pixels). More... | |
void | GetSize (int *width, int *height) const |
Get the caret size. More... | |
wxSize | GetSize () const |
Get the caret size. More... | |
void | Move (int x, int y) |
Move the caret to given position (in logical coordinates). More... | |
void | Move (const wxPoint &pt) |
Move the caret to given position (in logical coordinates). More... | |
void | SetSize (int width, int height) |
Changes the size of the caret. More... | |
void | SetSize (const wxSize &size) |
Changes the size of the caret. More... | |
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). More... | |
static void | SetBlinkTime (int milliseconds) |
Sets the blink time for all the carets. More... | |
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.
Creates a caret with the given size (in pixels) and associates it with the window (same as the equivalent constructors).
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).
|
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).
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::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:
wxSize wxCaret::GetSize | ( | ) | const |
Get the caret size.
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:
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 | ( | const wxPoint & | pt | ) |
Move the caret to given position (in logical coordinates).
void wxCaret::Move | ( | int | x, |
int | y | ||
) |
Move the caret to given position (in logical coordinates).
|
static |
Sets the blink time for all the carets.
void wxCaret::SetSize | ( | const wxSize & | size | ) |
Changes the size of the caret.
void wxCaret::SetSize | ( | int | width, |
int | height | ||
) |
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.