]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/caret.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxCaret
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 A caret is a blinking cursor showing the position where the typed text will
13 appear. Text controls usually have their own caret but wxCaret provides a
14 way to use a caret in other windows.
16 Currently, the caret appears as a rectangle of the given size. In the
17 future, it will be possible to specify a bitmap to be used for the caret
20 A caret is always associated with a window and the current caret can be
21 retrieved using wxWindow::GetCaret(). The same caret can't be reused in two
37 Creates a caret with the given size (in pixels) and associates it with
40 wxCaret(wxWindow
* window
, int width
, int height
);
41 wxCaret(wxWindowBase
* window
, const wxSize
& size
);
46 Creates a caret with the given size (in pixels) and associates it with
47 the @a window (same as the equivalent constructors).
49 bool Create(wxWindowBase
* window
, int width
, int height
);
50 bool Create(wxWindowBase
* window
, const wxSize
& size
);
54 Returns the blink time which is measured in milliseconds and is the
55 time elapsed between 2 inversions of the caret (blink time of the caret
56 is the same for all carets, so this functions is static).
58 static int GetBlinkTime();
62 Get the caret position (in pixels).
64 void GetPosition(int* x
, int* y
) const;
65 const wxPoint
GetPosition() const;
72 void GetSize(int* width
, int* height
) const;
73 const wxSize
GetSize() const;
77 Get the window the caret is associated with.
79 wxWindow
* GetWindow() const;
82 Hides the caret, same as Show(@false).
87 Returns @true if the caret was created successfully.
92 Returns @true if the caret is visible and @false if it is permanently
93 hidden (if it is is blinking and not shown currently but will be after
94 the next blink, this method still returns @true).
96 bool IsVisible() const;
100 Move the caret to given position (in logical coordinates).
102 void Move(int x
, int y
);
103 void Move(const wxPoint
& pt
);
107 Sets the blink time for all the carets.
109 @warning Under Windows, this function will change the blink time for
110 all carets permanently (until the next time it is called),
111 even for carets in other applications.
115 static void SetBlinkTime(int milliseconds
);
119 Changes the size of the caret.
121 void SetSize(int width
, int height
);
122 void SetSize(const wxSize
& size
);
126 Shows or hides the caret. Notice that if the caret was hidden N times,
127 it must be shown N times as well to reappear on the screen.
129 void Show(bool show
= true);