2006-10-22 22:28:37 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/generic/collpaneg.h
|
|
|
|
// Purpose: wxGenericCollapsiblePane
|
|
|
|
// Author: Francesco Montorsi
|
|
|
|
// Modified by:
|
|
|
|
// Created: 8/10/2006
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Francesco Montorsi
|
|
|
|
// Licence: wxWindows Licence
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_COLLAPSABLE_PANE_H_GENERIC_
|
|
|
|
#define _WX_COLLAPSABLE_PANE_H_GENERIC_
|
|
|
|
|
|
|
|
// forward declared
|
2006-10-22 23:23:12 +00:00
|
|
|
class WXDLLEXPORT wxButton;
|
2006-10-22 22:28:37 +00:00
|
|
|
class WXDLLEXPORT wxStaticLine;
|
|
|
|
|
|
|
|
// class name
|
2006-11-11 07:32:08 +00:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[];
|
2006-10-22 22:28:37 +00:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxGenericCollapsiblePane
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2006-11-04 20:03:48 +00:00
|
|
|
class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase
|
2006-10-22 22:28:37 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGenericCollapsiblePane() { Init(); }
|
|
|
|
|
|
|
|
wxGenericCollapsiblePane(wxWindow *parent,
|
|
|
|
wxWindowID winid,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2006-11-11 07:32:08 +00:00
|
|
|
long style = wxCP_DEFAULT_STYLE,
|
2006-10-22 22:28:37 +00:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2006-11-11 07:32:08 +00:00
|
|
|
const wxString& name = wxCollapsiblePaneNameStr)
|
2006-10-22 22:28:37 +00:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
|
|
|
Create(parent, winid, label, pos, size, style, val, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init()
|
|
|
|
{
|
|
|
|
m_pButton = NULL;
|
|
|
|
m_pPane = NULL;
|
2006-10-30 20:08:17 +00:00
|
|
|
m_pStaticLine = NULL;
|
|
|
|
m_sz = NULL;
|
2006-10-22 22:28:37 +00:00
|
|
|
}
|
|
|
|
|
2006-10-30 20:08:17 +00:00
|
|
|
~wxGenericCollapsiblePane();
|
|
|
|
|
2006-10-22 22:28:37 +00:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID winid,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2006-11-11 07:32:08 +00:00
|
|
|
long style = wxCP_DEFAULT_STYLE,
|
2006-10-22 22:28:37 +00:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2006-11-11 07:32:08 +00:00
|
|
|
const wxString& name = wxCollapsiblePaneNameStr);
|
2006-10-22 22:28:37 +00:00
|
|
|
|
2006-10-22 23:23:12 +00:00
|
|
|
// public wxCollapsiblePane API
|
|
|
|
virtual void Collapse(bool collapse = true);
|
|
|
|
virtual void SetLabel(const wxString &label);
|
2006-10-22 22:28:37 +00:00
|
|
|
|
2006-10-22 23:23:12 +00:00
|
|
|
virtual bool IsCollapsed() const
|
2006-10-22 22:28:37 +00:00
|
|
|
{ return m_pPane==NULL || !m_pPane->IsShown(); }
|
2006-10-22 23:23:12 +00:00
|
|
|
virtual wxWindow *GetPane() const
|
2006-10-22 22:28:37 +00:00
|
|
|
{ return m_pPane; }
|
2006-10-22 23:23:12 +00:00
|
|
|
virtual wxString GetLabel() const
|
2006-10-22 22:28:37 +00:00
|
|
|
{ return m_strLabel; }
|
|
|
|
|
2006-12-07 07:22:55 +00:00
|
|
|
virtual bool Layout();
|
2006-10-22 23:27:10 +00:00
|
|
|
|
|
|
|
// implementation only, don't use
|
|
|
|
void OnStateChange(const wxSize& sizeNew);
|
|
|
|
|
2006-10-24 10:35:44 +00:00
|
|
|
protected:
|
2006-10-22 23:23:12 +00:00
|
|
|
// overridden methods
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
2006-10-22 22:28:37 +00:00
|
|
|
|
|
|
|
wxString GetBtnLabel() const;
|
2006-10-30 20:08:17 +00:00
|
|
|
int GetBorder() const;
|
2006-10-22 22:28:37 +00:00
|
|
|
|
2006-10-22 23:23:12 +00:00
|
|
|
// child controls
|
2006-10-22 22:28:37 +00:00
|
|
|
wxButton *m_pButton;
|
2006-10-30 20:08:17 +00:00
|
|
|
wxStaticLine *m_pStaticLine;
|
2006-10-22 22:28:37 +00:00
|
|
|
wxWindow *m_pPane;
|
2006-10-30 20:08:17 +00:00
|
|
|
wxSizer *m_sz;
|
2006-10-22 22:28:37 +00:00
|
|
|
|
|
|
|
// the button label without ">>" or "<<"
|
|
|
|
wxString m_strLabel;
|
|
|
|
|
|
|
|
private:
|
2006-10-22 23:23:12 +00:00
|
|
|
// event handlers
|
|
|
|
void OnButton(wxCommandEvent &ev);
|
|
|
|
void OnSize(wxSizeEvent &ev);
|
|
|
|
|
2006-10-22 22:28:37 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
2006-10-22 23:23:12 +00:00
|
|
|
#endif // _WX_COLLAPSABLE_PANE_H_GENERIC_
|