2009-10-05 18:54:13 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/generic/infobar.h
|
|
|
|
// Purpose: generic wxInfoBar class declaration
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Created: 2009-07-28
|
2009-12-05 14:57:58 -05:00
|
|
|
// RCS-ID: $Id$
|
2009-10-05 18:54:13 -04:00
|
|
|
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
|
|
|
|
// Licence: wxWindows licence
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_GENERIC_INFOBAR_H_
|
|
|
|
#define _WX_GENERIC_INFOBAR_H_
|
|
|
|
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxBitmapButton;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxStaticBitmap;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxStaticText;
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxInfoBar
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2010-05-05 08:20:08 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxInfoBarGeneric : public wxInfoBarBase
|
2009-10-05 18:54:13 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// the usual ctors and Create() but remember that info bar is created
|
|
|
|
// hidden
|
2009-10-05 18:55:10 -04:00
|
|
|
wxInfoBarGeneric() { Init(); }
|
2009-10-05 18:54:13 -04:00
|
|
|
|
2009-10-05 18:55:10 -04:00
|
|
|
wxInfoBarGeneric(wxWindow *parent, wxWindowID winid = wxID_ANY)
|
2009-10-05 18:54:13 -04:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
Create(parent, winid);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY);
|
|
|
|
|
|
|
|
|
|
|
|
// implement base class methods
|
|
|
|
// ----------------------------
|
|
|
|
|
2009-10-05 18:55:10 -04:00
|
|
|
virtual void ShowMessage(const wxString& msg,
|
|
|
|
int flags = wxICON_INFORMATION);
|
2009-10-05 18:54:13 -04:00
|
|
|
|
2009-10-05 18:56:07 -04:00
|
|
|
virtual void Dismiss();
|
|
|
|
|
2009-10-05 18:54:31 -04:00
|
|
|
virtual void AddButton(wxWindowID btnid, const wxString& label = wxString());
|
|
|
|
|
2009-10-05 18:55:17 -04:00
|
|
|
virtual void RemoveButton(wxWindowID btnid);
|
2009-10-05 18:54:13 -04:00
|
|
|
|
|
|
|
// methods specific to this version
|
|
|
|
// --------------------------------
|
|
|
|
|
|
|
|
// set the effect(s) to use when showing/hiding the bar, may be
|
|
|
|
// wxSHOW_EFFECT_NONE to disable any effects entirely
|
|
|
|
//
|
|
|
|
// by default, slide to bottom/top is used when it's positioned on the top
|
|
|
|
// of the window for showing/hiding it and top/bottom when it's positioned
|
|
|
|
// at the bottom
|
|
|
|
void SetShowHideEffects(wxShowEffect showEffect, wxShowEffect hideEffect)
|
|
|
|
{
|
|
|
|
m_showEffect = showEffect;
|
|
|
|
m_hideEffect = hideEffect;
|
|
|
|
}
|
|
|
|
|
|
|
|
// get effect used when showing/hiding the window
|
2009-10-05 18:57:45 -04:00
|
|
|
wxShowEffect GetShowEffect() const;
|
|
|
|
wxShowEffect GetHideEffect() const;
|
2009-10-05 18:54:13 -04:00
|
|
|
|
|
|
|
// set the duration of animation used when showing/hiding the bar, in ms
|
|
|
|
void SetEffectDuration(int duration) { m_effectDuration = duration; }
|
|
|
|
|
|
|
|
// get the currently used effect animation duration
|
|
|
|
int GetEffectDuration() const { return m_effectDuration; }
|
|
|
|
|
2009-10-05 18:54:24 -04:00
|
|
|
|
|
|
|
// overridden base class methods
|
|
|
|
// -----------------------------
|
|
|
|
|
|
|
|
// setting the font of this window sets it for the text control inside it
|
|
|
|
// (default font is a larger and bold version of the normal one)
|
|
|
|
virtual bool SetFont(const wxFont& font);
|
|
|
|
|
2009-10-05 18:55:10 -04:00
|
|
|
protected:
|
2009-10-05 18:56:22 -04:00
|
|
|
// info bar shouldn't have any border by default, the colour difference
|
|
|
|
// between it and the main window separates it well enough
|
|
|
|
virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
|
|
|
|
|
|
|
|
|
2009-10-05 18:55:10 -04:00
|
|
|
// update the parent to take our new or changed size into account (notably
|
|
|
|
// should be called when we're shown or hidden)
|
|
|
|
void UpdateParent();
|
|
|
|
|
2009-10-05 18:54:13 -04:00
|
|
|
private:
|
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
// handler for the close button
|
|
|
|
void OnButton(wxCommandEvent& event);
|
|
|
|
|
|
|
|
// show/hide the bar
|
|
|
|
void DoShow();
|
|
|
|
void DoHide();
|
|
|
|
|
2009-10-05 18:57:45 -04:00
|
|
|
// determine the placement of the bar from its position in the containing
|
|
|
|
// sizer
|
|
|
|
enum BarPlacement
|
|
|
|
{
|
|
|
|
BarPlacement_Top,
|
|
|
|
BarPlacement_Bottom,
|
|
|
|
BarPlacement_Unknown
|
|
|
|
};
|
|
|
|
|
|
|
|
BarPlacement GetBarPlacement() const;
|
|
|
|
|
2009-10-05 18:54:13 -04:00
|
|
|
|
|
|
|
// different controls making up the bar
|
|
|
|
wxStaticBitmap *m_icon;
|
|
|
|
wxStaticText *m_text;
|
|
|
|
wxBitmapButton *m_button;
|
|
|
|
|
2009-10-05 18:57:45 -04:00
|
|
|
// the effects to use when showing/hiding and duration for them: by default
|
|
|
|
// the effect is determined by the info bar automatically depending on its
|
|
|
|
// position and the default duration is used
|
2009-10-05 18:54:13 -04:00
|
|
|
wxShowEffect m_showEffect,
|
|
|
|
m_hideEffect;
|
|
|
|
int m_effectDuration;
|
|
|
|
|
2009-10-05 18:55:22 -04:00
|
|
|
DECLARE_EVENT_TABLE()
|
2009-10-05 18:55:10 -04:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxInfoBarGeneric);
|
2009-10-05 18:54:13 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _WX_GENERIC_INFOBAR_H_
|
|
|
|
|