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
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxButton;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxStaticLine;
|
2008-07-29 16:30:22 -04:00
|
|
|
#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
|
2007-12-09 11:46:56 -05:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxDisclosureTriangle;
|
|
|
|
#endif
|
2006-10-22 18:28:37 -04:00
|
|
|
|
2008-02-10 20:24:19 -05:00
|
|
|
#include "wx/containr.h"
|
|
|
|
|
2006-10-22 18:28:37 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxGenericCollapsiblePane
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2011-07-24 18:19:33 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxGenericCollapsiblePane :
|
|
|
|
public wxNavigationEnabled<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);
|
|
|
|
}
|
|
|
|
|
2008-02-10 20:24:19 -05:00
|
|
|
virtual ~wxGenericCollapsiblePane();
|
2006-10-30 15:08:17 -05:00
|
|
|
|
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
|
|
|
|
2009-02-01 11:26:38 -05:00
|
|
|
|
|
|
|
// for the generic collapsible pane only:
|
|
|
|
wxControl* GetControlWidget() const
|
2009-02-01 15:59:03 -05:00
|
|
|
{ return (wxControl*)m_pButton; }
|
2009-02-01 11:26:38 -05:00
|
|
|
|
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
|
2008-07-29 16:30:22 -04:00
|
|
|
#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
|
2007-12-08 13:49:08 -05:00
|
|
|
wxDisclosureTriangle *m_pButton;
|
|
|
|
#else
|
2006-10-22 18:28:37 -04:00
|
|
|
wxButton *m_pButton;
|
2007-12-08 13:49:08 -05:00
|
|
|
#endif
|
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:
|
2008-02-10 20:24:19 -05:00
|
|
|
void Init();
|
|
|
|
|
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_
|