]> git.saurik.com Git - wxWidgets.git/blame_incremental - interface/wx/caret.h
Add test for absence of events from wxSpinCtrlDouble ctor.
[wxWidgets.git] / interface / wx / caret.h
... / ...
CommitLineData
1/////////////////////////////////////////////////////////////////////////////
2// Name: caret.h
3// Purpose: interface of wxCaret
4// Author: wxWidgets team
5// Licence: wxWindows licence
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxCaret
10
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.
14
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
17 shape.
18
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
21 different windows.
22
23 @library{wxcore}
24 @category{misc}
25*/
26class wxCaret
27{
28public:
29 /**
30 Default constructor.
31 */
32 wxCaret();
33
34 //@{
35 /**
36 Creates a caret with the given size (in pixels) and associates it with
37 the @a window.
38 */
39 wxCaret(wxWindow* window, int width, int height);
40 wxCaret(wxWindow* window, const wxSize& size);
41 //@}
42
43 //@{
44 /**
45 Creates a caret with the given size (in pixels) and associates it with
46 the @a window (same as the equivalent constructors).
47 */
48 bool Create(wxWindow* window, int width, int height);
49 bool Create(wxWindow* window, const wxSize& size);
50 //@}
51
52 /**
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).
56 */
57 static int GetBlinkTime();
58
59 //@{
60 /**
61 Get the caret position (in pixels).
62
63 @beginWxPerlOnly
64 In wxPerl there are two methods instead of a single overloaded
65 method:
66 - GetPosition(): returns a Wx::Point object.
67 - GetPositionXY(): returns a 2-element list (x, y).
68 @endWxPerlOnly
69 */
70 void GetPosition(int* x, int* y) const;
71 wxPoint GetPosition() const;
72 //@}
73
74 //@{
75 /**
76 Get the caret size.
77
78 @beginWxPerlOnly
79 In wxPerl there are two methods instead of a single overloaded
80 method:
81 - GetSize(): returns a Wx::Size object.
82 - GetSizeWH(): returns a 2-element list (width, height).
83 @endWxPerlOnly
84 */
85 void GetSize(int* width, int* height) const;
86 wxSize GetSize() const;
87 //@}
88
89 /**
90 Get the window the caret is associated with.
91 */
92 wxWindow* GetWindow() const;
93
94 /**
95 Hides the caret, same as Show(@false).
96 */
97 virtual void Hide();
98
99 /**
100 Returns @true if the caret was created successfully.
101 */
102 bool IsOk() const;
103
104 /**
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).
108 */
109 bool IsVisible() const;
110
111 //@{
112 /**
113 Move the caret to given position (in logical coordinates).
114 */
115 void Move(int x, int y);
116 void Move(const wxPoint& pt);
117 //@}
118
119 /**
120 Sets the blink time for all the carets.
121
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.
125
126 @see GetBlinkTime()
127 */
128 static void SetBlinkTime(int milliseconds);
129
130 //@{
131 /**
132 Changes the size of the caret.
133 */
134 void SetSize(int width, int height);
135 void SetSize(const wxSize& size);
136 //@}
137
138 /**
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.
141 */
142 virtual void Show(bool show = true);
143};
144