OpenCPN Partial API docs
Loading...
Searching...
No Matches
expand_icon.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 LIBS_GUI_EXPAND_ICON__H_
21#define LIBS_GUI_EXPAND_ICON__H_
22
23#include <functional>
24
25#include <wx/bitmap.h>
26#include <wx/panel.h>
27#include <wx/statbmp.h>
28
35class ExpandableIcon : public wxPanel {
36public :
43 ExpandableIcon(wxWindow* parent, std::function<void(bool)> on_toggle);
44
45 bool IsCollapsed() const { return m_is_collapsed; }
46
47protected:
48 bool m_is_collapsed;
49 wxBitmap m_collapse_bitmap;
50 wxBitmap m_expand_bitmap;
51 wxStaticBitmap* m_static_bitmap;
52 std::function<void(bool)> m_on_toggle;
53
54 void Toggle();
55};
56
57#endif // LIBS_GUI_EXPAND_ICON__H_
Simple panel showing either an "expand" or "collapse" icon, state switches when clicked.
Definition expand_icon.h:35
ExpandableIcon(wxWindow *parent, std::function< void(bool)> on_toggle)
Create a new expandable icon.