]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/caret.h
Ensure that the overall table border doesn't get overdrawn by cell borders with a...
[wxWidgets.git] / interface / wx / caret.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: caret.h
e54c96f1 3// Purpose: interface of wxCaret
23324ae1 4// Author: wxWidgets team
526954c5 5// Licence: wxWindows licence
23324ae1
FM
6/////////////////////////////////////////////////////////////////////////////
7
8/**
9 @class wxCaret
7c913512 10
23324ae1 11 A caret is a blinking cursor showing the position where the typed text will
bfac6166
BP
12 appear. Text controls usually have their own caret but wxCaret provides a
13 way to use a caret in other windows.
7c913512 14
bfac6166
BP
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.
7c913512 18
23324ae1 19 A caret is always associated with a window and the current caret can be
bfac6166
BP
20 retrieved using wxWindow::GetCaret(). The same caret can't be reused in two
21 different windows.
7c913512 22
23324ae1
FM
23 @library{wxcore}
24 @category{misc}
23324ae1 25*/
7c913512 26class wxCaret
23324ae1
FM
27{
28public:
23324ae1 29 /**
bfac6166 30 Default constructor.
23324ae1
FM
31 */
32 wxCaret();
bfac6166
BP
33
34 //@{
35 /**
36 Creates a caret with the given size (in pixels) and associates it with
37 the @a window.
38 */
7c913512 39 wxCaret(wxWindow* window, int width, int height);
37a181d5 40 wxCaret(wxWindow* window, const wxSize& size);
23324ae1
FM
41 //@}
42
43 //@{
44 /**
bfac6166
BP
45 Creates a caret with the given size (in pixels) and associates it with
46 the @a window (same as the equivalent constructors).
23324ae1 47 */
37a181d5
RD
48 bool Create(wxWindow* window, int width, int height);
49 bool Create(wxWindow* window, const wxSize& size);
23324ae1
FM
50 //@}
51
52 /**
bfac6166
BP
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).
23324ae1
FM
56 */
57 static int GetBlinkTime();
58
59 //@{
60 /**
61 Get the caret position (in pixels).
1058f652
MB
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
23324ae1 69 */
328f5751 70 void GetPosition(int* x, int* y) const;
882678eb 71 wxPoint GetPosition() const;
23324ae1
FM
72 //@}
73
74 //@{
75 /**
76 Get the caret size.
1058f652
MB
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
23324ae1 84 */
328f5751 85 void GetSize(int* width, int* height) const;
882678eb 86 wxSize GetSize() const;
23324ae1
FM
87 //@}
88
89 /**
90 Get the window the caret is associated with.
91 */
328f5751 92 wxWindow* GetWindow() const;
23324ae1
FM
93
94 /**
bfac6166 95 Hides the caret, same as Show(@false).
23324ae1 96 */
9d9c1c24 97 virtual void Hide();
23324ae1
FM
98
99 /**
100 Returns @true if the caret was created successfully.
101 */
328f5751 102 bool IsOk() const;
23324ae1
FM
103
104 /**
105 Returns @true if the caret is visible and @false if it is permanently
d13b34d3 106 hidden (if it is blinking and not shown currently but will be after
bfac6166 107 the next blink, this method still returns @true).
23324ae1 108 */
328f5751 109 bool IsVisible() const;
23324ae1
FM
110
111 //@{
112 /**
113 Move the caret to given position (in logical coordinates).
114 */
115 void Move(int x, int y);
7c913512 116 void Move(const wxPoint& pt);
23324ae1
FM
117 //@}
118
119 /**
120 Sets the blink time for all the carets.
3c4f71cc 121
bfac6166
BP
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.
3c4f71cc 125
4cc4bfaf 126 @see GetBlinkTime()
23324ae1
FM
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);
7c913512 135 void SetSize(const wxSize& size);
23324ae1
FM
136 //@}
137
138 /**
bfac6166
BP
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.
23324ae1 141 */
9d9c1c24 142 virtual void Show(bool show = true);
23324ae1 143};
e54c96f1 144