{"id":51522531,"url":"https://github.com/lszl84/wx_filehistory_tutorial","last_synced_at":"2026-07-08T17:01:49.386Z","repository":{"id":294030364,"uuid":"657520139","full_name":"lszl84/wx_filehistory_tutorial","owner":"lszl84","description":"How to use wxFileHistory in wxWidgets","archived":false,"fork":false,"pushed_at":"2025-05-18T14:42:51.000Z","size":823,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-18T15:35:55.444Z","etag":null,"topics":["cpp","wxfilehistory","wxwidgets"],"latest_commit_sha":null,"homepage":"https://www.lukesdevtutorials.com","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lszl84.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-23T08:39:46.000Z","updated_at":"2025-05-18T14:42:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"6102e755-0e6e-40d9-a8ed-e98287076cd7","html_url":"https://github.com/lszl84/wx_filehistory_tutorial","commit_stats":null,"previous_names":["lszl84/wx_filehistory_tutorial"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lszl84/wx_filehistory_tutorial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lszl84%2Fwx_filehistory_tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lszl84%2Fwx_filehistory_tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lszl84%2Fwx_filehistory_tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lszl84%2Fwx_filehistory_tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lszl84","download_url":"https://codeload.github.com/lszl84/wx_filehistory_tutorial/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lszl84%2Fwx_filehistory_tutorial/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35271852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-08T02:00:06.796Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","wxfilehistory","wxwidgets"],"created_at":"2026-07-08T17:01:48.774Z","updated_at":"2026-07-08T17:01:49.380Z","avatar_url":"https://github.com/lszl84.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Using `wxFileHistory` to build a list of recently opened files for C++ Desktop Apps.\n\nThe code in this repository shows how to integrate `wxFileHistory` with `wxWidgets`' Document-View Framework. If you want an example on how to use `wxFileHistory` manually, then scroll to the bottom of this page.\n\n[![Video](/output.gif)](https://youtu.be/u3Y5qkJob04)\n\nFull Tutorial: https://youtu.be/u3Y5qkJob04\n\nThis tutorial is a part of the series about building a multiplatform Paint App in C++ with wxWidgets: https://www.youtube.com/watch?v=Spt5VF1aSps\u0026list=PL0qQTroQZs5sxKZDdJrn8fEjNXCPT7f5T\n\n## Requirements\n\nThis works on Windows, Mac, and Linux. You'll need `cmake` and a C++ compiler (tested on `clang`, `gcc`, and MSVC).\n\nLinux builds require the GTK3 library and headers installed in the system.\n\n## Building\n\nTo build the project, use:\n\n```bash\ncmake -S. -Bbuild\ncmake --build build\n```\n\nThis will create a directory named `build` and create all build artifacts there. The main executable can be found in the `build/subprojects/Build/wx_filehistory_tutorial_core` folder.\n\n## Simple Example\n\nHere's the `wxFileHistory` example from the beginning of the video tutorial:\n\n```cpp\n#include \u003cwx/wx.h\u003e\n#include \u003cwx/filedlg.h\u003e\n#include \u003cwx/filehistory.h\u003e\n#include \u003cwx/config.h\u003e\n\nclass MyApp : public wxApp\n{\npublic:\n    virtual bool OnInit();\n};\n\nclass MyFrame : public wxFrame\n{\npublic:\n    MyFrame(const wxString \u0026title, const wxPoint \u0026pos, const wxSize \u0026size);\n    virtual ~MyFrame()\n    {\n    }\n\nprivate:\n    void SetupMenuBar();\n\n    wxFileHistory fileHistory;\n};\n\nwxIMPLEMENT_APP(MyApp);\n\nbool MyApp::OnInit()\n{\n    SetAppName(\"FileHistoryApp\");\n\n    MyFrame *frame = new MyFrame(\"Hello World\", wxDefaultPosition, wxDefaultSize);\n    frame-\u003eShow(true);\n    return true;\n}\n\nMyFrame::MyFrame(const wxString \u0026title, const wxPoint \u0026pos, const wxSize \u0026size)\n    : wxFrame(NULL, wxID_ANY, title, pos, size)\n{\n    SetupMenuBar();\n}\n\nvoid MyFrame::SetupMenuBar()\n{\n    constexpr int ClearHistoryMenuId = 1000;\n\n    wxMenu *menuFile = new wxMenu;\n    menuFile-\u003eAppend(wxID_NEW);\n    menuFile-\u003eAppend(wxID_OPEN);\n    menuFile-\u003eAppendSeparator();\n\n    wxMenu *historySubMenu = new wxMenu;\n    historySubMenu-\u003eAppend(ClearHistoryMenuId, \"Clear history\");\n\n    menuFile-\u003eAppendSubMenu(historySubMenu, \"Open Recent\");\n    menuFile-\u003eAppend(wxID_EXIT);\n\n    this-\u003eBind(\n        wxEVT_MENU, [\u0026](wxCommandEvent \u0026event)\n        {\n            while(fileHistory.GetCount() \u003e 0) {\n                fileHistory.RemoveFileFromHistory(0);\n            }\n            fileHistory.Save(*wxConfig::Get()); },\n        ClearHistoryMenuId);\n\n    this-\u003eBind(\n        wxEVT_MENU, [\u0026](wxCommandEvent \u0026event)\n        {\n            wxFileDialog openFileDialog(this, \"Open file\", \"\", \"\", \"All files (*.*)|*.*\",\n                                        wxFD_OPEN | wxFD_FILE_MUST_EXIST);\n            if (openFileDialog.ShowModal() == wxID_OK)\n            {\n                wxString path = openFileDialog.GetPath();\n                wxMessageBox(\"Opening: \" + path);\n\n                fileHistory.AddFileToHistory(path);\n                fileHistory.Save(*wxConfig::Get());\n            } },\n        wxID_OPEN);\n\n    this-\u003eBind(\n        wxEVT_MENU, [\u0026](wxCommandEvent \u0026event)\n        { Close(); },\n        wxID_EXIT);\n\n    fileHistory.UseMenu(historySubMenu);\n    fileHistory.Load(*wxConfig::Get());\n\n    this-\u003eBind(\n        wxEVT_MENU, [\u0026](wxCommandEvent \u0026event)\n        {\n            const auto historyId = event.GetId() - fileHistory.GetBaseId();\n            const auto path = fileHistory.GetHistoryFile(historyId);\n            wxMessageBox(\"You clicked: \" + path); },\n        fileHistory.GetBaseId(),\n        fileHistory.GetBaseId() + fileHistory.GetMaxFiles());\n\n    wxMenu *editMenu = new wxMenu();\n    editMenu-\u003eAppend(wxID_COPY);\n    editMenu-\u003eAppend(wxID_CUT);\n    editMenu-\u003eAppend(wxID_PASTE);\n\n    wxMenu *menuHelp = new wxMenu;\n    menuHelp-\u003eAppend(wxID_ABOUT);\n    wxMenuBar *menuBar = new wxMenuBar;\n\n    menuBar-\u003eAppend(menuFile, \"\u0026File\");\n    menuBar-\u003eAppend(editMenu, \"Edit\");\n    menuBar-\u003eAppend(menuHelp, \"\u0026Help\");\n\n    SetMenuBar(menuBar);\n}\n```\n\n---\nCheck out the blog for more! [www.devmindscape.com](https://www.devmindscape.com)\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flszl84%2Fwx_filehistory_tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flszl84%2Fwx_filehistory_tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flszl84%2Fwx_filehistory_tutorial/lists"}