2006-10-22 18:28:37 -04: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 19:23:12 -04:00
|
|
|
class WXDLLEXPORT wxButton;
|
2006-10-22 18:28:37 -04:00
|
|
|
class WXDLLEXPORT wxStaticLine;
|
|
|
|
|
|
|
|
// class name
|
2006-11-11 02:32:08 -05:00
|
|
|
extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxCollapsiblePaneNameStr[];
|
2006-10-22 18:28:37 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxGenericCollapsiblePane
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2006-11-04 15:03:48 -05:00
|
|
|
class WXDLLIMPEXP_CORE wxGenericCollapsiblePane : public wxCollapsiblePaneBase
|
2006-10-22 18:28:37 -04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxGenericCollapsiblePane() { Init(); }
|
|
|
|
|
|
|
|
wxGenericCollapsiblePane(wxWindow *parent,
|
|
|
|
wxWindowID winid,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2006-11-11 02:32:08 -05:00
|
|
|
long style = wxCP_DEFAULT_STYLE,
|
2006-10-22 18:28:37 -04:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2006-11-11 02:32:08 -05:00
|
|
|
const wxString& name = wxCollapsiblePaneNameStr)
|
2006-10-22 18:28:37 -04:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
|
|
|
|
Create(parent, winid, label, pos, size, style, val, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init()
|
|
|
|
{
|
|
|
|
m_pButton = NULL;
|
|
|
|
m_pPane = NULL;
|
2006-10-30 15:08:17 -05:00
|
|
|
m_pStaticLine = NULL;
|
|
|
|
m_sz = NULL;
|
2006-10-22 18:28:37 -04:00
|
|
|
}
|
|
|
|
|
2006-10-30 15:08:17 -05:00
|
|
|
~wxGenericCollapsiblePane();
|
|
|
|
|
2006-10-22 18:28:37 -04:00
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID winid,
|
|
|
|
const wxString& label,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2006-11-11 02:32:08 -05:00
|
|
|
long style = wxCP_DEFAULT_STYLE,
|
2006-10-22 18:28:37 -04:00
|
|
|
const wxValidator& val = wxDefaultValidator,
|
2006-11-11 02:32:08 -05:00
|
|
|
const wxString& name = wxCollapsiblePaneNameStr);
|
2006-10-22 18:28:37 -04:00
|
|
|
|
2006-10-22 19:23:12 -04:00
|
|
|
// public wxCollapsiblePane API
|
|
|
|
virtual void Collapse(bool collapse = true);
|
|
|
|
virtual void SetLabel(const wxString &label);
|
2006-10-22 18:28:37 -04:00
|
|
|
|
2006-10-22 19:23:12 -04:00
|
|
|
virtual bool IsCollapsed() const
|
2006-10-22 18:28:37 -04:00
|
|
|
{ return m_pPane==NULL || !m_pPane->IsShown(); }
|
2006-10-22 19:23:12 -04:00
|
|
|
virtual wxWindow *GetPane() const
|
2006-10-22 18:28:37 -04:00
|
|
|
{ return m_pPane; }
|
2006-10-22 19:23:12 -04:00
|
|
|
virtual wxString GetLabel() const
|
2006-10-22 18:28:37 -04:00
|
|
|
{ return m_strLabel; }
|
|
|
|
|
2006-12-07 02:22:55 -05:00
|
|
|
virtual bool Layout();
|
2006-10-22 19:27:10 -04:00
|
|
|
|
|
|
|
// implementation only, don't use
|
|
|
|
void OnStateChange(const wxSize& sizeNew);
|
|
|
|
|
2006-10-24 06:35:44 -04:00
|
|
|
protected:
|
2006-10-22 19:23:12 -04:00
|
|
|
// overridden methods
|
|
|
|
virtual wxSize DoGetBestSize() const;
|
2006-10-22 18:28:37 -04:00
|
|
|
|
|
|
|
wxString GetBtnLabel() const;
|
2006-10-30 15:08:17 -05:00
|
|
|
int GetBorder() const;
|
2006-10-22 18:28:37 -04:00
|
|
|
|
2006-10-22 19:23:12 -04:00
|
|
|
// child controls
|
2006-10-22 18:28:37 -04:00
|
|
|
wxButton *m_pButton;
|
2006-10-30 15:08:17 -05:00
|
|
|
wxStaticLine *m_pStaticLine;
|
2006-10-22 18:28:37 -04:00
|
|
|
wxWindow *m_pPane;
|
2006-10-30 15:08:17 -05:00
|
|
|
wxSizer *m_sz;
|
2006-10-22 18:28:37 -04:00
|
|
|
|
|
|
|
// the button label without ">>" or "<<"
|
|
|
|
wxString m_strLabel;
|
|
|
|
|
|
|
|
private:
|
2006-10-22 19:23:12 -04:00
|
|
|
// event handlers
|
|
|
|
void OnButton(wxCommandEvent &ev);
|
|
|
|
void OnSize(wxSizeEvent &ev);
|
|
|
|
|
2006-10-22 18:28:37 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxGenericCollapsiblePane)
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
};
|
|
|
|
|
2006-10-22 19:23:12 -04:00
|
|
|
#endif // _WX_COLLAPSABLE_PANE_H_GENERIC_
|