Initial wxInfoBar implementation.
Add generic implementation, documentation and examples showing the use of the new class in the samples. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -696,6 +696,14 @@
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_IMAGLIST) */
|
||||
|
||||
#ifndef wxUSE_INFOBAR
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_INFOBAR must be defined."
|
||||
# else
|
||||
# define wxUSE_INFOBAR 0
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_INFOBAR) */
|
||||
|
||||
#ifndef wxUSE_JOYSTICK
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_JOYSTICK must be defined."
|
||||
|
107
include/wx/generic/infobar.h
Normal file
107
include/wx/generic/infobar.h
Normal file
@@ -0,0 +1,107 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/generic/infobar.h
|
||||
// Purpose: generic wxInfoBar class declaration
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2009-07-28
|
||||
// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
|
||||
// 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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxInfoBar : public wxInfoBarBase
|
||||
{
|
||||
public:
|
||||
// the usual ctors and Create() but remember that info bar is created
|
||||
// hidden
|
||||
wxInfoBar() { Init(); }
|
||||
|
||||
wxInfoBar(wxWindow *parent, wxWindowID winid = wxID_ANY)
|
||||
{
|
||||
Init();
|
||||
Create(parent, winid);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY);
|
||||
|
||||
|
||||
// implement base class methods
|
||||
// ----------------------------
|
||||
|
||||
virtual void ShowMessage(const wxString& msg, int flags = wxICON_NONE);
|
||||
|
||||
|
||||
// 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
|
||||
wxShowEffect GetShowEffect() const { return m_showEffect; }
|
||||
wxShowEffect GetHideEffect() const { return m_hideEffect; }
|
||||
|
||||
// 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; }
|
||||
|
||||
private:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// handler for the close button
|
||||
void OnButton(wxCommandEvent& event);
|
||||
|
||||
// update the parent after we're shown or hidden
|
||||
void UpdateParent();
|
||||
|
||||
// change the parent background colour to match that of our sibling
|
||||
void ChangeParentBackground();
|
||||
|
||||
// restore the parent background changed by the above function
|
||||
void RestoreParentBackground();
|
||||
|
||||
// show/hide the bar
|
||||
void DoShow();
|
||||
void DoHide();
|
||||
|
||||
|
||||
// different controls making up the bar
|
||||
wxStaticBitmap *m_icon;
|
||||
wxStaticText *m_text;
|
||||
wxBitmapButton *m_button;
|
||||
|
||||
// the effects to use when showing/hiding and duration for them
|
||||
wxShowEffect m_showEffect,
|
||||
m_hideEffect;
|
||||
int m_effectDuration;
|
||||
|
||||
// the original parent background colour, before we changed it
|
||||
wxColour m_origParentBgCol;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxInfoBar);
|
||||
};
|
||||
|
||||
#endif // _WX_GENERIC_INFOBAR_H_
|
||||
|
49
include/wx/infobar.h
Normal file
49
include/wx/infobar.h
Normal file
@@ -0,0 +1,49 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/infobar.h
|
||||
// Purpose: declaration of wxInfoBarBase defining common API of wxInfoBar
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2009-07-28
|
||||
// RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
|
||||
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_INFOBAR_H_
|
||||
#define _WX_INFOBAR_H_
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_INFOBAR
|
||||
|
||||
#include "wx/window.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxInfoBar shows non-critical but important information to the user
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxInfoBarBase : public wxWindow
|
||||
{
|
||||
public:
|
||||
// real ctors are provided by the derived classes, just notice that unlike
|
||||
// most of the other windows, info bar is created hidden and must be
|
||||
// explicitly shown when it is needed (this is done because it is supposed
|
||||
// to be shown only intermittently and hiding it after creating it from the
|
||||
// user code would result in flicker)
|
||||
wxInfoBarBase() { }
|
||||
|
||||
|
||||
// show the info bar with the given message and optionally an icon
|
||||
virtual void ShowMessage(const wxString& msg, int flags = wxICON_NONE) = 0;
|
||||
|
||||
private:
|
||||
wxDECLARE_NO_COPY_CLASS(wxInfoBarBase);
|
||||
};
|
||||
|
||||
// include platform-dependent implementation
|
||||
//
|
||||
// TODO-GTK: implement a native version using GtkInfoBar (GTK+ 2.18+)
|
||||
#include "wx/generic/infobar.h"
|
||||
|
||||
#endif // wxUSE_INFOBAR
|
||||
|
||||
#endif // _WX_INFOBAR_H_
|
@@ -570,6 +570,14 @@
|
||||
// possible in which case setting this to 0 can gain up to 100KB.
|
||||
#define wxUSE_VARIANT 1
|
||||
|
||||
// Support for wxAny class, the successor for wxVariant.
|
||||
//
|
||||
// Default is 1.
|
||||
//
|
||||
// Recommended setting: 1 unless you want to reduce the library size by a small amount,
|
||||
// or your compiler cannot for some reason cope with complexity of templates used.
|
||||
#define wxUSE_ANY 1
|
||||
|
||||
// Support for regular expression matching via wxRegEx class: enable this to
|
||||
// use POSIX regular expressions in your code. You need to compile regex
|
||||
// library from src/regex to use it under Windows.
|
||||
@@ -891,6 +899,14 @@
|
||||
// enumerated above, then this class is mostly useless too)
|
||||
#define wxUSE_IMAGLIST 1
|
||||
|
||||
// Use wxInfoBar class.
|
||||
//
|
||||
// Default is 1.
|
||||
//
|
||||
// Recommended setting: 1 (but can be disabled without problems as nothing
|
||||
// depends on it)
|
||||
#define wxUSE_INFOBAR 1
|
||||
|
||||
// Use wxMenu, wxMenuBar, wxMenuItem.
|
||||
//
|
||||
// Default is 1.
|
||||
|
@@ -899,6 +899,14 @@
|
||||
// enumerated above, then this class is mostly useless too)
|
||||
#define wxUSE_IMAGLIST 1
|
||||
|
||||
// Use wxInfoBar class.
|
||||
//
|
||||
// Default is 1.
|
||||
//
|
||||
// Recommended setting: 1 (but can be disabled without problems as nothing
|
||||
// depends on it)
|
||||
#define wxUSE_INFOBAR 1
|
||||
|
||||
// Use wxMenu, wxMenuBar, wxMenuItem.
|
||||
//
|
||||
// Default is 1.
|
||||
|
@@ -899,6 +899,14 @@
|
||||
// enumerated above, then this class is mostly useless too)
|
||||
#define wxUSE_IMAGLIST 1
|
||||
|
||||
// Use wxInfoBar class.
|
||||
//
|
||||
// Default is 1.
|
||||
//
|
||||
// Recommended setting: 1 (but can be disabled without problems as nothing
|
||||
// depends on it)
|
||||
#define wxUSE_INFOBAR 1
|
||||
|
||||
// Use wxMenu, wxMenuBar, wxMenuItem.
|
||||
//
|
||||
// Default is 1.
|
||||
|
@@ -899,6 +899,14 @@
|
||||
// enumerated above, then this class is mostly useless too)
|
||||
#define wxUSE_IMAGLIST 1
|
||||
|
||||
// Use wxInfoBar class.
|
||||
//
|
||||
// Default is 1.
|
||||
//
|
||||
// Recommended setting: 1 (but can be disabled without problems as nothing
|
||||
// depends on it)
|
||||
#define wxUSE_INFOBAR 1
|
||||
|
||||
// Use wxMenu, wxMenuBar, wxMenuItem.
|
||||
//
|
||||
// Default is 1.
|
||||
|
@@ -900,6 +900,14 @@
|
||||
// enumerated above, then this class is mostly useless too)
|
||||
#define wxUSE_IMAGLIST 1
|
||||
|
||||
// Use wxInfoBar class.
|
||||
//
|
||||
// Default is 1.
|
||||
//
|
||||
// Recommended setting: 1 (but can be disabled without problems as nothing
|
||||
// depends on it)
|
||||
#define wxUSE_INFOBAR 1
|
||||
|
||||
// Use wxMenu, wxMenuBar, wxMenuItem.
|
||||
//
|
||||
// Default is 1.
|
||||
|
@@ -899,6 +899,14 @@
|
||||
// enumerated above, then this class is mostly useless too)
|
||||
#define wxUSE_IMAGLIST 1
|
||||
|
||||
// Use wxInfoBar class.
|
||||
//
|
||||
// Default is 1.
|
||||
//
|
||||
// Recommended setting: 1 (but can be disabled without problems as nothing
|
||||
// depends on it)
|
||||
#define wxUSE_INFOBAR 1
|
||||
|
||||
// Use wxMenu, wxMenuBar, wxMenuItem.
|
||||
//
|
||||
// Default is 1.
|
||||
|
@@ -895,6 +895,14 @@
|
||||
// enumerated above, then this class is mostly useless too)
|
||||
#define wxUSE_IMAGLIST 1
|
||||
|
||||
// Use wxInfoBar class.
|
||||
//
|
||||
// Default is 1.
|
||||
//
|
||||
// Recommended setting: 1 (but can be disabled without problems as nothing
|
||||
// depends on it)
|
||||
#define wxUSE_INFOBAR 1
|
||||
|
||||
// Use wxMenu, wxMenuBar, wxMenuItem.
|
||||
//
|
||||
// Default is 1.
|
||||
|
@@ -898,6 +898,14 @@
|
||||
// enumerated above, then this class is mostly useless too)
|
||||
#define wxUSE_IMAGLIST 1
|
||||
|
||||
// Use wxInfoBar class.
|
||||
//
|
||||
// Default is 1.
|
||||
//
|
||||
// Recommended setting: 1 (but can be disabled without problems as nothing
|
||||
// depends on it)
|
||||
#define wxUSE_INFOBAR 1
|
||||
|
||||
// Use wxMenu, wxMenuBar, wxMenuItem.
|
||||
//
|
||||
// Default is 1.
|
||||
|
Reference in New Issue
Block a user