]> git.saurik.com Git - wxWidgets.git/blob - interface/caret.h
remove unused wxAppTraits-related files
[wxWidgets.git] / interface / caret.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: caret.h
3 // Purpose: interface of wxCaret
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxCaret
11 @wxheader{caret.h}
12
13 A caret is a blinking cursor showing the position where the typed text will
14 appear. Text controls usually have their own caret but wxCaret provides a
15 way to use a caret in other windows.
16
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.
20
21 A caret is always associated with a window and the current caret can be
22 retrieved using wxWindow::GetCaret(). The same caret can't be reused in two
23 different windows.
24
25 @library{wxcore}
26 @category{misc}
27 */
28 class wxCaret
29 {
30 public:
31 /**
32 Default constructor.
33 */
34 wxCaret();
35
36 //@{
37 /**
38 Creates a caret with the given size (in pixels) and associates it with
39 the @a window.
40 */
41 wxCaret(wxWindow* window, int width, int height);
42 wxCaret(wxWindowBase* window, const wxSize& size);
43 //@}
44
45 //@{
46 /**
47 Creates a caret with the given size (in pixels) and associates it with
48 the @a window (same as the equivalent constructors).
49 */
50 bool Create(wxWindowBase* window, int width, int height);
51 bool Create(wxWindowBase* window, const wxSize& size);
52 //@}
53
54 /**
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).
58 */
59 static int GetBlinkTime();
60
61 //@{
62 /**
63 Get the caret position (in pixels).
64 */
65 void GetPosition(int* x, int* y) const;
66 const wxPoint GetPosition() const;
67 //@}
68
69 //@{
70 /**
71 Get the caret size.
72 */
73 void GetSize(int* width, int* height) const;
74 const wxSize GetSize() const;
75 //@}
76
77 /**
78 Get the window the caret is associated with.
79 */
80 wxWindow* GetWindow() const;
81
82 /**
83 Hides the caret, same as Show(@false).
84 */
85 void Hide();
86
87 /**
88 Returns @true if the caret was created successfully.
89 */
90 bool IsOk() const;
91
92 /**
93 Returns @true if the caret is visible and @false if it is permanently
94 hidden (if it is is blinking and not shown currently but will be after
95 the next blink, this method still returns @true).
96 */
97 bool IsVisible() const;
98
99 //@{
100 /**
101 Move the caret to given position (in logical coordinates).
102 */
103 void Move(int x, int y);
104 void Move(const wxPoint& pt);
105 //@}
106
107 /**
108 Sets the blink time for all the carets.
109
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.
113
114 @see GetBlinkTime()
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);
123 void SetSize(const wxSize& size);
124 //@}
125
126 /**
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.
129 */
130 void Show(bool show = true);
131 };
132