OpenCPN Partial API docs
Loading...
Searching...
No Matches
expand_panel.h
1/***************************************************************************
2 * Copyright (C) 2025 Alec Leamas *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 **************************************************************************/
19
20#ifndef SHOW_HIDE_WIDGET__H_
21#define SHOW_HIDE_WIDGET__H_
22
23#include <functional>
24
25#include <wx/panel.h>
26
27#include "expand_icon.h"
28
33class ExpandablePanel : public wxPanel {
34public:
41 ExpandablePanel(wxWindow* parent, wxWindow* child,
42 std::function<void()> on_resize = [] {});
47 ExpandablePanel(wxWindow* parent);
48
54 void Create(wxWindow* child, std::function<void()> on_resize = [] {} );
55
57 wxWindow* GetIcon() const { return m_expand_icon; }
58
60 wxWindow* GetChild() const { return m_child; }
61
62protected:
63 void OnClick(bool collapse);
64
65private:
66 bool m_show;
67 wxWindow* m_child;
68 ExpandableIcon* m_expand_icon;
69 std::function<void()> m_on_resize;
70};
71#endif // SHOW_HIDE_WIDGET__H_
Simple panel showing either an "expand" or "collapse" icon, state switches when clicked.
Definition expand_icon.h:35
An ExpandIcon together with a child window.
ExpandablePanel(wxWindow *parent, wxWindow *child, std::function< void()> on_resize=[] {})
Single step constructor.
void Create(wxWindow *child, std::function< void()> on_resize=[] {})
Second part of two step creation.
ExpandablePanel(wxWindow *parent)
First part of two step create.
wxWindow * GetIcon() const
Return the ExpandableIcon reflecting expanded/collapsed state.
wxWindow * GetChild() const
Return the managed window which is shown or hidden.