{"id":4607,"date":"2024-12-15T05:18:38","date_gmt":"2024-12-15T05:18:38","guid":{"rendered":"https:\/\/truelogic.org\/wordpress\/?p=4607"},"modified":"2024-12-15T05:18:38","modified_gmt":"2024-12-15T05:18:38","slug":"15-wxwidgets-using-wxaui","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2024\/12\/15\/15-wxwidgets-using-wxaui\/","title":{"rendered":"15.wxWidgets &#8211; Using wxAUI"},"content":{"rendered":"\n<p><strong>OVERVIEW<\/strong><\/p>\n\n\n\n<p>Though wxWidgets is a great cross-platform UI library with all the modern GUI widgets that we use, what it does not have are docking containers and resizable panels. This problem has been solved by the wxAUI library which allows wxWidgets applications to have docking and resizing features. It introduces two classes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>wxFrameManager<\/li>\n\n\n\n<li>wxFrameInfo<\/li>\n<\/ul>\n\n\n\n<p>These two classes act as wrapper containers around your wxWidgets. You can find the complete class reference here: <a href=\"https:\/\/www.kirix.com\/labs\/wxaui\/documentation\/class-reference.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.kirix.com\/labs\/wxaui\/documentation\/class-reference.html<\/a><\/p>\n\n\n\n<p><strong>SAMPLE CODE<\/strong><\/p>\n\n\n\n<p>Given below is a slightly modified sample code to build a simple wxAUI application:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n#include &lt;wx\/wxprec.h&gt;\n#ifndef WX_PRECOMP\n#include &lt;wx\/wx.h&gt;\n#endif \/\/ WX_PRECOMP\n#include &lt;wx\/aui\/aui.h&gt;\n#include &lt;wx\/aui\/framemanager.h&gt;\n\nclass TestFrame:public wxFrame {\npublic:\n    TestFrame(const wxString&amp; title);\n    ~TestFrame();\n\nprivate:\n    wxAuiManager m_mgr;\n};\n\nTestFrame::TestFrame(const wxString&amp; title):\n    wxFrame(NULL, -1, title, wxDefaultPosition, wxSize(800,500), wxDEFAULT_FRAME_STYLE) {\n\n    m_mgr.SetManagedWindow(this);\n    \/\/ create several text controls\n    wxTextCtrl* text1 = new wxTextCtrl(this, -1, _(&quot;Pane 1 - sample text&quot;),\n    wxDefaultPosition, wxSize(200,150),\n    wxNO_BORDER | wxTE_MULTILINE);\n\n    wxTextCtrl* text2 = new wxTextCtrl(this, -1, _(&quot;Pane 2 - sample text&quot;),\n    wxDefaultPosition, wxSize(200,150),\n    wxNO_BORDER | wxTE_MULTILINE);\n\n    wxTextCtrl* text3 = new wxTextCtrl(this, -1, _(&quot;Main content window&quot;),\n    wxDefaultPosition, wxSize(200,150),\n    wxNO_BORDER | wxTE_MULTILINE);\n\n    \/\/ add the panes to the manager\n    m_mgr.AddPane(text1, wxLEFT, wxT(&quot;Pane Number One&quot;));\n    m_mgr.AddPane(text2, wxBOTTOM, wxT(&quot;Pane Number Two&quot;));\n    m_mgr.AddPane(text3, wxCENTER);\n    m_mgr.Update();\n}\n\nTestFrame::~TestFrame() {\n    m_mgr.UnInit();\n}\n\nclass MainApp:public wxApp {\npublic:\n    virtual bool OnInit();\n};\n\nbool MainApp::OnInit() {\n    wxFrame* frm = new TestFrame(wxT(&quot;My Frame Title&quot;));\n    SetTopWindow(frm);\n    frm-&gt;Show();\n    return TRUE;\n}\n\nwxIMPLEMENT_APP(MainApp);\n\n\n<\/pre><\/div>\n\n\n<p>If you are using Code:Blocks as your IDE, then you need to add std and aui to your Project->Build Options->Linker Settings: `<code>wx-config --libs std au<\/code>i`<\/p>\n\n\n\n<p>For details on building wxWidgets applications in Code:Blocks see <a href=\"https:\/\/truelogic.org\/wordpress\/2023\/09\/15\/setting-up-wxwidgets-with-codeblocks-in-ubuntu\/\">https:\/\/truelogic.org\/wordpress\/2023\/09\/15\/setting-up-wxwidgets-with-codeblocks-in-ubuntu\/<\/a><\/p>\n\n\n\n<p>The sample output is given below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"758\" height=\"450\" src=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-15-10-45-31.png\" alt=\"\" class=\"wp-image-4613\" srcset=\"https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-15-10-45-31.png 758w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-15-10-45-31-620x368.png 620w, https:\/\/truelogic.org\/wordpress\/wp-content\/uploads\/2024\/12\/Screenshot-from-2024-12-15-10-45-31-300x178.png 300w\" sizes=\"auto, (max-width: 758px) 100vw, 758px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>OVERVIEW Though wxWidgets is a great cross-platform UI library with all the modern GUI widgets that we use, what it does not have are docking <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2024\/12\/15\/15-wxwidgets-using-wxaui\/\" title=\"15.wxWidgets &#8211; Using wxAUI\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":4405,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[302,365],"tags":[],"class_list":["post-4607","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cc","category-wxwidgets"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/4607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=4607"}],"version-history":[{"count":7,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/4607\/revisions"}],"predecessor-version":[{"id":4615,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/4607\/revisions\/4615"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media\/4405"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=4607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=4607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=4607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}