]> git.saurik.com Git - wxWidgets.git/blame - interface/caret.h
add handling of wxWrapSizer flags (part of ticket 9468)
[wxWidgets.git] / interface / caret.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: caret.h
e54c96f1 3// Purpose: interface of wxCaret
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxCaret
11 @wxheader{caret.h}
7c913512 12
23324ae1 13 A caret is a blinking cursor showing the position where the typed text will
bfac6166
BP
14 appear. Text controls usually have their own caret but wxCaret provides a
15 way to use a caret in other windows.
7c913512 16
bfac6166
BP
17 Currently, the caret appears as a rectangle of the given size. In the
18 future, it will be possible to specify a bitmap to be used for the caret
19 shape.
7c913512 20
23324ae1 21 A caret is always associated with a window and the current caret can be
bfac6166
BP
22 retrieved using wxWindow::GetCaret(). The same caret can't be reused in two
23 different windows.
7c913512 24
23324ae1
FM
25 @library{wxcore}
26 @category{misc}
23324ae1 27*/
7c913512 28class wxCaret
23324ae1
FM
29{
30public:
23324ae1 31 /**
bfac6166 32 Default constructor.
23324ae1
FM
33 */
34 wxCaret();
bfac6166
BP
35
36 //@{
37 /**
38 Creates a caret with the given size (in pixels) and associates it with
39 the @a window.
40 */
7c913512
FM
41 wxCaret(wxWindow* window, int width, int height);
42 wxCaret(wxWindowBase* window, const wxSize& size);
23324ae1
FM
43 //@}
44
45 //@{
46 /**
bfac6166
BP
47 Creates a caret with the given size (in pixels) and associates it with
48 the @a window (same as the equivalent constructors).
23324ae1
FM
49 */
50 bool Create(wxWindowBase* window, int width, int height);
7c913512 51 bool Create(wxWindowBase* window, const wxSize& size);
23324ae1
FM
52 //@}
53
54 /**
bfac6166
BP
55 Returns the blink time which is measured in milliseconds and is the
56 time elapsed between 2 inversions of the caret (blink time of the caret
57 is the same for all carets, so this functions is static).
23324ae1
FM
58 */
59 static int GetBlinkTime();
60
61 //@{
62 /**
63 Get the caret position (in pixels).
23324ae1 64 */
328f5751 65 void GetPosition(int* x, int* y) const;
bfac6166 66 const wxPoint GetPosition() const;
23324ae1
FM
67 //@}
68
69 //@{
70 /**
71 Get the caret size.
23324ae1 72 */
328f5751
FM
73 void GetSize(int* width, int* height) const;
74 const wxSize GetSize() const;
23324ae1
FM
75 //@}
76
77 /**
78 Get the window the caret is associated with.
79 */
328f5751 80 wxWindow* GetWindow() const;
23324ae1
FM
81
82 /**
bfac6166 83 Hides the caret, same as Show(@false).
23324ae1
FM
84 */
85 void Hide();
86
87 /**
88 Returns @true if the caret was created successfully.
89 */
328f5751 90 bool IsOk() const;
23324ae1
FM
91
92 /**
93 Returns @true if the caret is visible and @false if it is permanently
bfac6166
BP
94 hidden (if it is is blinking and not shown currently but will be after
95 the next blink, this method still returns @true).
23324ae1 96 */
328f5751 97 bool IsVisible() const;
23324ae1
FM
98
99 //@{
100 /**
101 Move the caret to given position (in logical coordinates).
102 */
103 void Move(int x, int y);
7c913512 104 void Move(const wxPoint& pt);
23324ae1
FM
105 //@}
106
107 /**
108 Sets the blink time for all the carets.
3c4f71cc 109
bfac6166
BP
110 @warning Under Windows, this function will change the blink time for
111 all carets permanently (until the next time it is called),
112 even for carets in other applications.
3c4f71cc 113
4cc4bfaf 114 @see GetBlinkTime()
23324ae1
FM
115 */
116 static void SetBlinkTime(int milliseconds);
117
118 //@{
119 /**
120 Changes the size of the caret.
121 */
122 void SetSize(int width, int height);
7c913512 123 void SetSize(const wxSize& size);
23324ae1
FM
124 //@}
125
126 /**
bfac6166
BP
127 Shows or hides the caret. Notice that if the caret was hidden N times,
128 it must be shown N times as well to reappear on the screen.
23324ae1 129 */
4cc4bfaf 130 void Show(bool show = true);
23324ae1 131};
e54c96f1 132