2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: caret.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxCaret
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxCaret
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A caret is a blinking cursor showing the position where the typed text will
|
2008-04-05 05:12:23 -04:00
|
|
|
appear. Text controls usually have their own caret but wxCaret provides a
|
|
|
|
way to use a caret in other windows.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-04-05 05:12:23 -04:00
|
|
|
Currently, the caret appears as a rectangle of the given size. In the
|
|
|
|
future, it will be possible to specify a bitmap to be used for the caret
|
|
|
|
shape.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A caret is always associated with a window and the current caret can be
|
2008-04-05 05:12:23 -04:00
|
|
|
retrieved using wxWindow::GetCaret(). The same caret can't be reused in two
|
|
|
|
different windows.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{misc}
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
class wxCaret
|
2008-03-08 08:52:38 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-04-05 05:12:23 -04:00
|
|
|
Default constructor.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxCaret();
|
2008-04-05 05:12:23 -04:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Creates a caret with the given size (in pixels) and associates it with
|
|
|
|
the @a window.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxCaret(wxWindow* window, int width, int height);
|
|
|
|
wxCaret(wxWindowBase* window, const wxSize& size);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
2008-04-05 05:12:23 -04:00
|
|
|
Creates a caret with the given size (in pixels) and associates it with
|
|
|
|
the @a window (same as the equivalent constructors).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Create(wxWindowBase* window, int width, int height);
|
2008-03-08 09:43:31 -05:00
|
|
|
bool Create(wxWindowBase* window, const wxSize& size);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
2008-04-05 05:12:23 -04:00
|
|
|
Returns the blink time which is measured in milliseconds and is the
|
|
|
|
time elapsed between 2 inversions of the caret (blink time of the caret
|
|
|
|
is the same for all carets, so this functions is static).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
static int GetBlinkTime();
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Get the caret position (in pixels).
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
void GetPosition(int* x, int* y) const;
|
2009-01-10 18:44:44 -05:00
|
|
|
wxPoint GetPosition() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Get the caret size.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
void GetSize(int* width, int* height) const;
|
2009-01-10 18:44:44 -05:00
|
|
|
wxSize GetSize() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Get the window the caret is associated with.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxWindow* GetWindow() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-04-05 05:12:23 -04:00
|
|
|
Hides the caret, same as Show(@false).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-21 19:48:04 -04:00
|
|
|
virtual void Hide();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the caret was created successfully.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsOk() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the caret is visible and @false if it is permanently
|
2008-04-05 05:12:23 -04:00
|
|
|
hidden (if it is is blinking and not shown currently but will be after
|
|
|
|
the next blink, this method still returns @true).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsVisible() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Move the caret to given position (in logical coordinates).
|
|
|
|
*/
|
|
|
|
void Move(int x, int y);
|
2008-03-08 09:43:31 -05:00
|
|
|
void Move(const wxPoint& pt);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the blink time for all the carets.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-04-05 05:12:23 -04:00
|
|
|
@warning Under Windows, this function will change the blink time for
|
|
|
|
all carets permanently (until the next time it is called),
|
|
|
|
even for carets in other applications.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetBlinkTime()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
static void SetBlinkTime(int milliseconds);
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Changes the size of the caret.
|
|
|
|
*/
|
|
|
|
void SetSize(int width, int height);
|
2008-03-08 09:43:31 -05:00
|
|
|
void SetSize(const wxSize& size);
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
2008-04-05 05:12:23 -04:00
|
|
|
Shows or hides the caret. Notice that if the caret was hidden N times,
|
|
|
|
it must be shown N times as well to reappear on the screen.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-21 19:48:04 -04:00
|
|
|
virtual void Show(bool show = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|