2000-09-10 12:30:16 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/tipwin.h
|
|
|
|
// Purpose: wxTipWindow is a window like the one typically used for
|
|
|
|
// showing the tooltips
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Modified by:
|
|
|
|
// Created: 10.09.00
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2000 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
2003-03-17 05:34:04 -05:00
|
|
|
// Licence: wxWindows licence
|
2000-09-10 12:30:16 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_TIPWIN_H_
|
|
|
|
#define _WX_TIPWIN_H_
|
|
|
|
|
2002-08-31 07:29:13 -04:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
2000-09-10 12:30:16 -04:00
|
|
|
#pragma interface "tipwin.h"
|
|
|
|
#endif
|
|
|
|
|
2001-12-01 20:54:38 -05:00
|
|
|
#if wxUSE_TIPWINDOW
|
2000-09-10 12:30:16 -04:00
|
|
|
|
2001-11-30 18:02:27 -05:00
|
|
|
#if wxUSE_POPUPWIN
|
2002-01-19 16:49:39 -05:00
|
|
|
#include "wx/popupwin.h"
|
|
|
|
|
|
|
|
#define wxTipWindowBase wxPopupTransientWindow
|
2001-12-01 20:54:38 -05:00
|
|
|
#else
|
2002-01-19 16:49:39 -05:00
|
|
|
#include "wx/frame.h"
|
|
|
|
|
|
|
|
#define wxTipWindowBase wxFrame
|
2001-12-01 20:54:38 -05:00
|
|
|
#endif
|
2001-11-30 22:18:24 -05:00
|
|
|
|
2002-01-19 16:49:39 -05:00
|
|
|
class WXDLLEXPORT wxTipWindowView;
|
|
|
|
|
2000-09-10 12:30:16 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxTipWindow
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2002-01-19 16:49:39 -05:00
|
|
|
class WXDLLEXPORT wxTipWindow : public wxTipWindowBase
|
2000-09-10 12:30:16 -04:00
|
|
|
{
|
|
|
|
public:
|
2002-01-19 16:49:39 -05:00
|
|
|
// the mandatory ctor parameters are: the parent window and the text to
|
|
|
|
// show
|
|
|
|
//
|
|
|
|
// optionally you may also specify the length at which the lines are going
|
|
|
|
// to be broken in rows (100 pixels by default)
|
|
|
|
//
|
|
|
|
// windowPtr and rectBound are just passed to SetTipWindowPtr() and
|
|
|
|
// SetBoundingRect() - see below
|
2000-09-10 12:30:16 -04:00
|
|
|
wxTipWindow(wxWindow *parent,
|
|
|
|
const wxString& text,
|
2002-01-19 16:49:39 -05:00
|
|
|
wxCoord maxLength = 100,
|
|
|
|
wxTipWindow** windowPtr = NULL,
|
|
|
|
wxRect *rectBound = NULL);
|
2001-02-22 12:29:51 -05:00
|
|
|
|
2002-01-19 16:49:39 -05:00
|
|
|
virtual ~wxTipWindow();
|
|
|
|
|
|
|
|
// If windowPtr is not NULL the given address will be NULLed when the
|
|
|
|
// window has closed
|
2001-02-22 12:29:51 -05:00
|
|
|
void SetTipWindowPtr(wxTipWindow** windowPtr) { m_windowPtr = windowPtr; }
|
2000-09-10 12:30:16 -04:00
|
|
|
|
2002-01-19 16:49:39 -05:00
|
|
|
// If rectBound is not NULL, the window will disappear automatically when
|
|
|
|
// the mouse leave the specified rect: note that rectBound should be in the
|
|
|
|
// screen coordinates!
|
|
|
|
void SetBoundingRect(const wxRect& rectBound);
|
|
|
|
|
|
|
|
// Hide and destroy the window
|
2001-11-30 18:02:27 -05:00
|
|
|
void Close();
|
|
|
|
|
2000-09-10 12:30:16 -04:00
|
|
|
protected:
|
2002-01-19 16:49:39 -05:00
|
|
|
// called by wxTipWindowView only
|
|
|
|
bool CheckMouseInBounds(const wxPoint& pos);
|
|
|
|
|
2000-09-10 12:30:16 -04:00
|
|
|
// event handlers
|
|
|
|
void OnMouseClick(wxMouseEvent& event);
|
2002-01-19 16:49:39 -05:00
|
|
|
|
2001-12-01 20:54:38 -05:00
|
|
|
#if !wxUSE_POPUPWIN
|
|
|
|
void OnActivate(wxActivateEvent& event);
|
|
|
|
void OnKillFocus(wxFocusEvent& event);
|
2002-01-19 16:49:39 -05:00
|
|
|
#else // wxUSE_POPUPWIN
|
|
|
|
virtual void OnDismiss();
|
|
|
|
#endif // wxUSE_POPUPWIN/!wxUSE_POPUPWIN
|
2000-09-10 12:30:16 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
wxArrayString m_textLines;
|
|
|
|
wxCoord m_heightLine;
|
2002-01-19 16:49:39 -05:00
|
|
|
|
|
|
|
wxTipWindowView *m_view;
|
|
|
|
|
2001-02-22 12:29:51 -05:00
|
|
|
wxTipWindow** m_windowPtr;
|
2002-01-19 16:49:39 -05:00
|
|
|
wxRect m_rectBound;
|
2000-09-10 12:30:16 -04:00
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
2002-01-19 16:49:39 -05:00
|
|
|
|
|
|
|
friend class wxTipWindowView;
|
2003-01-02 18:38:11 -05:00
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxTipWindow)
|
2000-09-10 12:30:16 -04:00
|
|
|
};
|
|
|
|
|
2001-12-01 20:54:38 -05:00
|
|
|
#endif // wxUSE_TIPWINDOW
|
2002-01-19 16:49:39 -05:00
|
|
|
|
2000-09-10 12:30:16 -04:00
|
|
|
#endif // _WX_TIPWIN_H_
|