]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/caret.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxCaret
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 A caret is a blinking cursor showing the position where the typed text will
12 appear. Text controls usually have their own caret but wxCaret provides a
13 way to use a caret in other windows.
15 Currently, the caret appears as a rectangle of the given size. In the
16 future, it will be possible to specify a bitmap to be used for the caret
19 A caret is always associated with a window and the current caret can be
20 retrieved using wxWindow::GetCaret(). The same caret can't be reused in two
36 Creates a caret with the given size (in pixels) and associates it with
39 wxCaret(wxWindow
* window
, int width
, int height
);
40 wxCaret(wxWindow
* window
, const wxSize
& size
);
45 Creates a caret with the given size (in pixels) and associates it with
46 the @a window (same as the equivalent constructors).
48 bool Create(wxWindow
* window
, int width
, int height
);
49 bool Create(wxWindow
* window
, const wxSize
& size
);
53 Returns the blink time which is measured in milliseconds and is the
54 time elapsed between 2 inversions of the caret (blink time of the caret
55 is the same for all carets, so this functions is static).
57 static int GetBlinkTime();
61 Get the caret position (in pixels).
64 In wxPerl there are two methods instead of a single overloaded
66 - GetPosition(): returns a Wx::Point object.
67 - GetPositionXY(): returns a 2-element list (x, y).
70 void GetPosition(int* x
, int* y
) const;
71 wxPoint
GetPosition() const;
79 In wxPerl there are two methods instead of a single overloaded
81 - GetSize(): returns a Wx::Size object.
82 - GetSizeWH(): returns a 2-element list (width, height).
85 void GetSize(int* width
, int* height
) const;
86 wxSize
GetSize() const;
90 Get the window the caret is associated with.
92 wxWindow
* GetWindow() const;
95 Hides the caret, same as Show(@false).
100 Returns @true if the caret was created successfully.
105 Returns @true if the caret is visible and @false if it is permanently
106 hidden (if it is blinking and not shown currently but will be after
107 the next blink, this method still returns @true).
109 bool IsVisible() const;
113 Move the caret to given position (in logical coordinates).
115 void Move(int x
, int y
);
116 void Move(const wxPoint
& pt
);
120 Sets the blink time for all the carets.
122 @warning Under Windows, this function will change the blink time for
123 all carets permanently (until the next time it is called),
124 even for carets in other applications.
128 static void SetBlinkTime(int milliseconds
);
132 Changes the size of the caret.
134 void SetSize(int width
, int height
);
135 void SetSize(const wxSize
& size
);
139 Shows or hides the caret. Notice that if the caret was hidden N times,
140 it must be shown N times as well to reappear on the screen.
142 virtual void Show(bool show
= true);