File: singlechoicedialog.h

package info (click to toggle)
libwx-perl 1%3A0.9932-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,300 kB
  • sloc: cpp: 11,064; perl: 8,603; ansic: 711; makefile: 53
file content (70 lines) | stat: -rw-r--r-- 2,023 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/////////////////////////////////////////////////////////////////////////////
// Name:        cpp/singlechoicedialog.h
// Purpose:     c++ wrapper for wxSingleChoiceDialog
// Author:      Mattia Barbon
// Modified by:
// Created:     11/02/2001
// RCS-ID:      $Id: singlechoicedialog.h 2057 2007-06-18 23:03:00Z mbarbon $
// Copyright:   (c) 2001-2002 Mattia Barbon
// Licence:     This program is free software; you can redistribute it and/or
//              modify it under the same terms as Perl itself
/////////////////////////////////////////////////////////////////////////////

// increments reference count of client data upon construction,
// and decrements it upon destruction
class wxPliSingleChoiceDialog:public wxSingleChoiceDialog
{
public:
    wxPliSingleChoiceDialog( wxWindow* parent, const wxString& message,
                             const wxString& caption, int n,
                             const wxString* choices, SV** clientdata,
                             long style, const wxPoint& pos );
    ~wxPliSingleChoiceDialog();
private:
    SV** m_data;
    int m_num;
};

inline wxPliSingleChoiceDialog::wxPliSingleChoiceDialog
    ( wxWindow* parent, const wxString& message, const wxString& caption,
      int n, const wxString* choices, SV** clientdata, long style,
      const wxPoint& pos )
    :wxSingleChoiceDialog( parent, message, caption, n, choices,
                           (void**)clientdata, style, pos ),
    m_data(0)
{
    dTHX;
    if( clientdata )
    {
        int i;

        for( i = 0; i < n; ++i )
        {
            SvREFCNT_inc( clientdata[i] );
        }

        m_data = new SV*[ n ];
        m_num = n;
        memcpy( m_data, clientdata, n * sizeof( SV* ) );
    }
}

inline wxPliSingleChoiceDialog::~wxPliSingleChoiceDialog()
{
    dTHX;
    if( m_data )
    {
        int i;

        for( i = 0; i < m_num; ++i )
        {
            SvREFCNT_dec( m_data[i] );
        }

        delete[] m_data;
    }
}

// Local variables: //
// mode: c++ //
// End: //