2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: caret.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxCaret
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxCaret
|
|
|
|
@wxheader{caret.h}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
A caret is a blinking cursor showing the position where the typed text will
|
2008-04-05 09:12:23 +00:00
|
|
|
appear. Text controls usually have their own caret but wxCaret provides a
|
|
|
|
way to use a caret in other windows.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-04-05 09:12:23 +00: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 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
A caret is always associated with a window and the current caret can be
|
2008-04-05 09:12:23 +00:00
|
|
|
retrieved using wxWindow::GetCaret(). The same caret can't be reused in two
|
|
|
|
different windows.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxcore}
|
|
|
|
@category{misc}
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxCaret
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-04-05 09:12:23 +00:00
|
|
|
Default constructor.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
wxCaret();
|
2008-04-05 09:12:23 +00:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Creates a caret with the given size (in pixels) and associates it with
|
|
|
|
the @a window.
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxCaret(wxWindow* window, int width, int height);
|
|
|
|
wxCaret(wxWindowBase* window, const wxSize& size);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
2008-04-05 09:12:23 +00: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 13:52:38 +00:00
|
|
|
*/
|
|
|
|
bool Create(wxWindowBase* window, int width, int height);
|
2008-03-08 14:43:31 +00:00
|
|
|
bool Create(wxWindowBase* window, const wxSize& size);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
2008-04-05 09:12:23 +00: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 13:52:38 +00:00
|
|
|
*/
|
|
|
|
static int GetBlinkTime();
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Get the caret position (in pixels).
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
void GetPosition(int* x, int* y) const;
|
2008-04-05 09:12:23 +00:00
|
|
|
const wxPoint GetPosition() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Get the caret size.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
void GetSize(int* width, int* height) const;
|
|
|
|
const wxSize GetSize() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Get the window the caret is associated with.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxWindow* GetWindow() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-04-05 09:12:23 +00:00
|
|
|
Hides the caret, same as Show(@false).
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
void Hide();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the caret was created successfully.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsOk() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the caret is visible and @false if it is permanently
|
2008-04-05 09:12:23 +00: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 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
bool IsVisible() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Move the caret to given position (in logical coordinates).
|
|
|
|
*/
|
|
|
|
void Move(int x, int y);
|
2008-03-08 14:43:31 +00:00
|
|
|
void Move(const wxPoint& pt);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the blink time for all the carets.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-04-05 09:12:23 +00: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 13:45:17 +00:00
|
|
|
|
2008-03-09 12:33:59 +00:00
|
|
|
@see GetBlinkTime()
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
static void SetBlinkTime(int milliseconds);
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Changes the size of the caret.
|
|
|
|
*/
|
|
|
|
void SetSize(int width, int height);
|
2008-03-08 14:43:31 +00:00
|
|
|
void SetSize(const wxSize& size);
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
2008-04-05 09:12:23 +00: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 13:52:38 +00:00
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
void Show(bool show = true);
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|