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
|
|
|
|
appear. The text controls usually have a caret but wxCaret class also allows
|
|
|
|
to use a caret in other windows.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +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
|
|
|
|
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
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxCaret::GetBlinkTime
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
class wxCaret
|
2008-03-08 13:52:38 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Create the caret of given (in pixels) width and height and associates it
|
|
|
|
with the given window.
|
|
|
|
*/
|
|
|
|
wxCaret();
|
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
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Create the caret of given (in pixels) width and height and associates it
|
|
|
|
with the given window (same as constructor).
|
|
|
|
*/
|
|
|
|
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
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
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).
|
|
|
|
*/
|
|
|
|
static int GetBlinkTime();
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Get the caret position (in pixels).
|
|
|
|
|
|
|
|
@b GetPosition()
|
|
|
|
|
|
|
|
Returns a Wx::Point
|
|
|
|
|
|
|
|
@b GetPositionXY()
|
|
|
|
|
|
|
|
Returns a 2-element list
|
|
|
|
@c ( x, y )
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
void GetPosition(int* x, int* y) const;
|
|
|
|
const wxPoint GetPosition() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Get the caret size.
|
|
|
|
|
|
|
|
@b GetSize()
|
|
|
|
|
|
|
|
Returns a Wx::Size
|
|
|
|
|
|
|
|
@b GetSizeWH()
|
|
|
|
|
|
|
|
Returns a 2-element list
|
|
|
|
@c ( width, height )
|
|
|
|
*/
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
Same as wxCaret::Show(@false).
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
hidden (if it is is blinking and not shown currently but will be after the
|
|
|
|
next blink, this method still returns @true).
|
|
|
|
*/
|
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.
|
|
|
|
|
|
|
|
@remarks Under Windows, this function will change the blink time for all
|
2008-03-09 12:33:59 +00:00
|
|
|
carets permanently (until the next time it is called),
|
|
|
|
even for the carets in other applications.
|
2008-03-08 13:52:38 +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
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
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-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
|
|
|
|