wxWidgets/samples/artprov/artbrows.h
PB 148cafdcd0 Fix memory leak in the art provider sample
The list client data must be destroyed not only when closing the
resource browser dialog (see 754f75c1cd (Fix memory leaks in artprov
sample, 2022-01-28) but also whenever the art client is changed.

See #23417, #23418.

(cherry picked from commit 02cba46643a5988db1b0e803e18e2dc1a55d1d21)
2023-04-04 17:18:33 +02:00

51 lines
1.3 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: artbrows.h
// Purpose: wxArtProvider demo - art browser dialog
// Author: Vaclav Slavik
// Modified by:
// Created: 2002/04/05
// Copyright: (c) Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef __ARTBROWS_H__
#define __ARTBROWS_H__
#include "wx/dialog.h"
#include "wx/artprov.h"
class WXDLLIMPEXP_FWD_CORE wxListCtrl;
class WXDLLIMPEXP_FWD_CORE wxListEvent;
class WXDLLIMPEXP_FWD_CORE wxStaticBitmap;
class wxArtBrowserDialog : public wxDialog
{
public:
wxArtBrowserDialog(wxWindow *parent);
~wxArtBrowserDialog();
void SetArtClient(const wxArtClient& client);
void SetArtBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size = wxDefaultSize);
private:
void OnSelectItem(wxListEvent &event);
void OnChangeSize(wxCommandEvent &event);
void OnChooseClient(wxCommandEvent &event);
wxSize GetSelectedBitmapSize() const;
void DeleteListItemData();
wxListCtrl *m_list;
wxStaticBitmap *m_canvas;
wxStaticText *m_text;
wxString m_client;
wxChoice *m_sizes;
wxString m_currentArtId;
wxDECLARE_EVENT_TABLE();
};
#endif // __ARTBROWS_H__