Debian Codegraph @

wxcrafter/top_level_windows/popup_window_wrapper.cpp

raw
1 #include "popup_window_wrapper.h"
2 #include "allocator_mgr.h"
3
4 PopupWindowWrapper::PopupWindowWrapper()
5 : TopLevelWinWrapper(ID_WXPOPUPWINDOW)
6 {
7 SetPropertyString(_("Common Settings"), "wxPopupWindow");
8 REMOVE_STYLE(wxCAPTION);
9 REMOVE_STYLE(wxSYSTEM_MENU);
10 REMOVE_STYLE(wxMAXIMIZE_BOX);
11 REMOVE_STYLE(wxMINIMIZE_BOX);
12 REMOVE_STYLE(wxRESIZE_BORDER);
13 REMOVE_STYLE(wxSTAY_ON_TOP);
14 REMOVE_STYLE(wxCLOSE_BOX);
15
16 m_namePattern = wxT("MyPopupWindow");
17 SetName(GenerateName());
18 }
19
20 PopupWindowWrapper::~PopupWindowWrapper() {}
21
22 wxcWidget* PopupWindowWrapper::Clone() const { return new PopupWindowWrapper(); }
23
24 wxString PopupWindowWrapper::CppCtorCode() const { return ""; }
25
26 void PopupWindowWrapper::GetIncludeFile(wxArrayString& headers) const
27 {
28 headers.Add("#include <wx/popupwin.h>");
29 headers.Add(wxT("#include <wx/artprov.h>"));
30 }
31
32 wxString PopupWindowWrapper::GetWxClassName() const { return "wxPopupWindow"; }
33
34 void PopupWindowWrapper::ToXRC(wxString& text, XRC_TYPE type) const
35 {
36 if(type != wxcWidget::XRC_LIVE) {
37 text << wxT("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>")
38 << wxT("<resource xmlns=\"http://www.wxwidgets.org/wxxrc\" >");
39 }
40
41 text << "<object class=\"wxPanel\" name=\"" << GetName() << "\" >"
42 << XRCStyle(type != wxcWidget::XRC_LIVE) // The parameter is to add the wxSTAY_ON_TOP, but not if we're 'live'
43 << XRCCommonAttributes() << XRCSize();
44
45 ChildrenXRC(text, type);
46 text << wxT("</object>");
47
48 if(type != wxcWidget::XRC_LIVE) { text << wxT("</resource>"); }
49 }
50
51 wxString PopupWindowWrapper::BaseCtorDecl() const
52 {
53 wxString code;
54 code << wxT(" ") << CreateBaseclassName() << wxT("(wxWindow* parent, long style = ")
55 << StyleFlags("wxBORDER_NONE") << ");\n";
56 return code;
57 }
58
59 wxString PopupWindowWrapper::BaseCtorImplPrefix() const
60 {
61 wxString code;
62 code << CreateBaseclassName() << wxT("::") << CreateBaseclassName() << wxT("(wxWindow* parent,long style)\n");
63 code << " : " << GetRealClassName() << "(parent, style)\n";
64 return code;
65 }
66
67 wxString PopupWindowWrapper::DesignerXRC(bool forPreviewDialog) const
68 {
69 wxString text;
70 text << wxT("<object class=\"wxPanel\" name=\"PreviewPanel\">") << wxT("<hidden>1</hidden>") << XRCSize();
71
72 ChildrenXRC(text, XRC_DESIGNER);
73 text << wxT("</object>");
74
75 WrapXRC(text);
76 return text;
77 }