File: addremovectrl.h

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (65 lines) | stat: -rw-r--r-- 2,225 bytes parent folder | download | duplicates (4)
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
///////////////////////////////////////////////////////////////////////////////
// Name:        wx/generic/private/addremovectrl.h
// Purpose:     Generic wxAddRemoveImpl implementation, also used in wxMSW
// Author:      Vadim Zeitlin
// Created:     2015-02-05
// Copyright:   (c) 2015 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence:     wxWindows licence
///////////////////////////////////////////////////////////////////////////////

#ifndef _WX_GENERIC_PRIVATE_ADDREMOVECTRL_H_
#define _WX_GENERIC_PRIVATE_ADDREMOVECTRL_H_

// ----------------------------------------------------------------------------
// wxAddRemoveImpl
// ----------------------------------------------------------------------------

class wxAddRemoveImpl : public wxAddRemoveImplWithButtons
{
public:
    wxAddRemoveImpl(wxAddRemoveAdaptor* adaptor,
                    wxAddRemoveCtrl* parent,
                    wxWindow* ctrlItems)
        : wxAddRemoveImplWithButtons(adaptor, parent, ctrlItems)
    {
        m_btnAdd = new wxButton(parent, wxID_ADD, GetAddButtonLabel(),
                                wxDefaultPosition, wxDefaultSize,
                                wxBU_EXACTFIT | wxBORDER_NONE);
        m_btnRemove = new wxButton(parent, wxID_REMOVE, GetRemoveButtonLabel(),
                                   wxDefaultPosition, wxDefaultSize,
                                   wxBU_EXACTFIT | wxBORDER_NONE);

        wxSizer* const sizerBtns = new wxBoxSizer(wxVERTICAL);
        sizerBtns->Add(m_btnAdd, wxSizerFlags().Expand());
        sizerBtns->Add(m_btnRemove, wxSizerFlags().Expand());

        wxSizer* const sizerTop = new wxBoxSizer(wxHORIZONTAL);
        sizerTop->Add(ctrlItems, wxSizerFlags(1).Expand());
        sizerTop->Add(sizerBtns, wxSizerFlags().Centre().Border(wxLEFT));
        parent->SetSizer(sizerTop);

        SetUpEvents();
    }

private:
    static wxString GetAddButtonLabel()
    {
#if wxUSE_UNICODE
        return wchar_t(0xFF0B); // FULLWIDTH PLUS SIGN
#else
        return "+";
#endif
    }

    static wxString GetRemoveButtonLabel()
    {
#if wxUSE_UNICODE
        return wchar_t(0x2012); // FIGURE DASH
#else
        return "-";
#endif
    }

};

#endif // _WX_GENERIC_PRIVATE_ADDREMOVECTRL_H_