diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 7ee154f..7a124c7 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -4,6 +4,7 @@ "name": "Linux", "includePath": [ "${workspaceFolder}/include/**", + "${workspaceFolder}/src/wxfb/**", "${workspaceFolder}/build/vcpkg_installed/x64-linux/include/**", "/usr/lib/x86_64-linux-gnu/wx/include/gtk3-unicode-3.2", "/usr/include/wx-3.2" diff --git a/README.md b/README.md index 5f39538..e1a4aea 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,10 @@ vcpkg is designed to statically compile programs and makes it difficult to rely However, a number of build tools are required to be present on the system. A `Dockerfile` documents which packages must be installed to acquire the necessary tools on a Debian-based system. You may install these directly or use the Docker-based build. +### Design Tools + +This project makes use of [wxFormBuilder](https://github.com/wxFormBuilder/wxFormBuilder) for rapid UI iteration. The project file and generated classes can be found under `src/wxfb`. + ## Build Steps > [!NOTE] @@ -99,16 +103,6 @@ For subsequent builds, vcpkg will make use of the binary cache under `$(pwd)/bui > [!WARNING] > This is the default vcpkg binary cache directory for this project. If your host system is Debian 12 (Bookworm), it should be safe to bind-mount this directory and share installed dependencies with the container. Users on other systems wishing to build with and without Docker may want to bind-mount to a different host directory (although builds targeting different system triplets can coexist). -## Design Tools - -This project is **not yet** making use of wxWidgets' XRC support. In the future, one of the following design tools will be recommended for work on the kdeck project: - -* codeblocks -* codelite -* wxglade - -**Suggestions are welcome.** - ## Kalshi API Kalshi provides a [REST API](https://trading-api.readme.io/reference/getting-started) for getting portfolio information and making trades, among other things. kdeck uses the [Oat++](https://oatpp.io/) library to make API requests[^1]. diff --git a/include/ui/BalancePanel.hpp b/include/ui/BalancePanel.hpp deleted file mode 100644 index f9e1b04..0000000 --- a/include/ui/BalancePanel.hpp +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef BALANCEPANEL_HPP -#define BALANCEPANEL_HPP - -#include - -namespace kdeck -{ - class Api; - class StaticCurrency; - - class BalancePanel : public wxPanel - { - public: - BalancePanel(wxWindow* parent, wxWindowID winid = wxID_ANY, double balance = 0.0); - - void UpdateStuff(Api* api); - - private: - StaticCurrency* lblBalanceAmount; - - // init - void Setup(); - }; -} - -#endif diff --git a/include/ui/EventPositionPanel.hpp b/include/ui/EventPositionPanel.hpp deleted file mode 100644 index 66c37ba..0000000 --- a/include/ui/EventPositionPanel.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef EVENTTPOSITIONPANEL_HPP -#define EVENTTPOSITIONPANEL_HPP - -#include - -#include - -namespace kdeck -{ - class EventPosition; - - class EventPositionPanel : public wxPanel - { - public: - EventPositionPanel(wxWindow* parent, wxWindowID winid, std::shared_ptr event); - - private: - std::shared_ptr event; - - // init - void Setup(); - }; -} - -#endif diff --git a/include/ui/ExchangeAnnouncementsDialog.hpp b/include/ui/ExchangeAnnouncementsDialog.hpp index f4ad6f6..77fe5da 100644 --- a/include/ui/ExchangeAnnouncementsDialog.hpp +++ b/include/ui/ExchangeAnnouncementsDialog.hpp @@ -3,22 +3,18 @@ #include +#include "App.h" // wxfb + namespace kdeck { class Api; - class ExchangeAnnouncementsDialog : public wxDialog + class ExchangeAnnouncementsDialog : public wxfb::ExchangeAnnouncementsDialog { public: - ExchangeAnnouncementsDialog(wxWindow* parent, wxWindowID winid = wxID_ANY, const wxString &title = "Exchange Announcements"); + ExchangeAnnouncementsDialog(wxWindow* parent, wxWindowID winid = wxID_ANY); void UpdateStuff(Api* api); - - private: - wxBoxSizer* boxSizer; - - // init - void Setup(); }; } diff --git a/include/ui/ExchangeScheduleDialog.hpp b/include/ui/ExchangeScheduleDialog.hpp index 2a86ab1..617537e 100644 --- a/include/ui/ExchangeScheduleDialog.hpp +++ b/include/ui/ExchangeScheduleDialog.hpp @@ -3,30 +3,18 @@ #include +#include "App.h" // wxfb + namespace kdeck { class Api; - class ExchangeScheduleDialog : public wxDialog + class ExchangeScheduleDialog : public wxfb::ExchangeScheduleDialog { public: - ExchangeScheduleDialog(wxWindow* parent, wxWindowID winid = wxID_ANY, const wxString &title = "Exchange Schedule"); + ExchangeScheduleDialog(wxWindow* parent, wxWindowID winid = wxID_ANY); void UpdateStuff(Api* api); - - private: - wxStaticText* lblSundaySchedule; - wxStaticText* lblMondaySchedule; - wxStaticText* lblTuesdaySchedule; - wxStaticText* lblWednesdaySchedule; - wxStaticText* lblThursdaySchedule; - wxStaticText* lblFridaySchedule; - wxStaticText* lblSaturdaySchedule; - - wxBoxSizer* boxSizer; - - // init - void Setup(); }; } diff --git a/include/ui/ExchangeStatusDialog.hpp b/include/ui/ExchangeStatusDialog.hpp index 01c6ed3..bb0c769 100644 --- a/include/ui/ExchangeStatusDialog.hpp +++ b/include/ui/ExchangeStatusDialog.hpp @@ -3,23 +3,18 @@ #include +#include "App.h" // wxfb + namespace kdeck { class Api; - class ExchangeStatusDialog : public wxDialog + class ExchangeStatusDialog : public wxfb::ExchangeStatusDialog { public: - ExchangeStatusDialog(wxWindow* parent, wxWindowID winid = wxID_ANY, const wxString &title = "Exchange Status"); + ExchangeStatusDialog(wxWindow* parent, wxWindowID winid = wxID_ANY); void UpdateStuff(Api* api); - - private: - wxStaticText* lblExchangeStatus; - wxStaticText* lblTradingStatus; - - // init - void Setup(); }; } diff --git a/include/ui/LoginDialog.hpp b/include/ui/LoginDialog.hpp index f765ee3..f6bb717 100644 --- a/include/ui/LoginDialog.hpp +++ b/include/ui/LoginDialog.hpp @@ -3,14 +3,16 @@ #include +#include "App.h" // wxfb + namespace kdeck { class Config; - class LoginDialog : public wxDialog + class LoginDialog : public wxfb::LoginDialog { public: - LoginDialog(wxWindow* parent, wxWindowID winid = wxID_ANY, const wxString &title = "Login"); + LoginDialog(wxWindow* parent, wxWindowID winid = wxID_ANY); void UpdateStuff(const Config* config); @@ -18,14 +20,6 @@ namespace kdeck std::string GetPassword() const; bool GetRememberMe() const; - - private: - wxTextCtrl* txtEmail; - wxTextCtrl* txtPassword; - wxCheckBox* chkRememberMe; - - // init - void Setup(); }; } diff --git a/include/ui/MainFrame.hpp b/include/ui/MainFrame.hpp index b7ce182..3eb5f70 100644 --- a/include/ui/MainFrame.hpp +++ b/include/ui/MainFrame.hpp @@ -3,25 +3,15 @@ #include +#include "App.h" // wxfb + #include "app_config.hpp" #include "api/Api.hpp" #include "config/Config.hpp" namespace kdeck { - class PortfolioPanel; - - enum - { - ID_Login = wxID_HIGHEST + 1, - ID_Logout = wxID_HIGHEST + 2, - ID_Exchange_Announcements = wxID_HIGHEST + 3, - ID_Exchange_Schedule = wxID_HIGHEST + 4, - ID_Exchange_Status = wxID_HIGHEST + 5, - ID_View_ShowClosedPositions = wxID_HIGHEST + 6, - }; - - class MainFrame : public wxFrame + class MainFrame : public wxfb::MainFrame { public: MainFrame(wxWindow* parent = nullptr, wxWindowID winid = wxID_ANY, const wxString &title = std::string{kProjectName}); @@ -33,11 +23,7 @@ namespace kdeck Config config; Api api; - wxMenuItem *mnuLogin; - wxMenuItem *mnuLogout; - wxMenuItem *mnuShowClosedPositions; - - PortfolioPanel* pnlPortfolio; + bool isLoginDialogShownOnce = false; // init void Setup(); @@ -54,9 +40,9 @@ namespace kdeck // event handlers void OnLoginOrLogout(wxCommandEvent& event); void OnApiError(wxCommandEvent& event); - void OnIdleRunOnce(wxIdleEvent& event); - void OnMenuItemSelected(wxCommandEvent& event); - void OnClose(wxCloseEvent& event); + void OnShow(wxShowEvent &event) override; + void OnMenuItemSelected(wxCommandEvent& event) override; + void OnClose(wxCloseEvent& event) override; }; } diff --git a/include/ui/MarketPositionPanel.hpp b/include/ui/MarketPositionPanel.hpp deleted file mode 100644 index 9bfd27e..0000000 --- a/include/ui/MarketPositionPanel.hpp +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef MARKETPOSITIONPANEL_HPP -#define MARKETPOSITIONPANEL_HPP - -#include - -#include - -namespace kdeck -{ - class MarketPosition; - - class MarketPositionPanel : public wxPanel - { - public: - MarketPositionPanel(wxWindow* parent, wxWindowID winid, std::shared_ptr market); - - private: - std::shared_ptr market; - - // init - void Setup(); - }; -} - -#endif diff --git a/include/ui/PortfolioPanel.hpp b/include/ui/PortfolioPanel.hpp index 18f3fb6..ff2d79c 100644 --- a/include/ui/PortfolioPanel.hpp +++ b/include/ui/PortfolioPanel.hpp @@ -3,25 +3,19 @@ #include +#include "PortfolioPanel.h" // wxfb + namespace kdeck { class Api; - class BalancePanel; class Config; - class PortfolioPanel : public wxScrolledWindow + class PortfolioPanel : public wxfb::PortfolioPanel { public: PortfolioPanel(wxWindow* parent, wxWindowID winid = wxID_ANY); void UpdateStuff(const Config* config, Api* api); - - private: - BalancePanel* pnlBalance; - wxPanel* pnlPositions; - - // init - void Setup(); }; } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a80808d..e02418a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,3 +23,4 @@ target_link_libraries(${PROJECT_NAME} add_subdirectory(api) add_subdirectory(config) add_subdirectory(ui) +add_subdirectory(wxfb) diff --git a/src/ui/BalancePanel.cpp b/src/ui/BalancePanel.cpp deleted file mode 100644 index be57f75..0000000 --- a/src/ui/BalancePanel.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include - -#include "api/Api.hpp" -#include "ui/BalancePanel.hpp" -#include "ui/StaticCurrency.hpp" -#include "ui/event.hpp" - -namespace kdeck -{ - // constructor //////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// - - BalancePanel::BalancePanel(wxWindow* parent, wxWindowID winid, double balance) - : wxPanel(parent, winid) - { - Setup(); - } - - // init /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// - - void BalancePanel::Setup() - { - wxStaticText* lblBalance = new wxStaticText(this, wxID_ANY, "Balance:"); - lblBalanceAmount = new StaticCurrency(this); - - wxBoxSizer* boxSizer = new wxBoxSizer(wxHORIZONTAL); - - wxSizerFlags flagsLbl = wxSizerFlags().Border(wxLEFT, 10).CenterVertical(); - - boxSizer->AddStretchSpacer(); - boxSizer->Add(lblBalance, flagsLbl); - boxSizer->Add(lblBalanceAmount, flagsLbl); - - SetSizerAndFit(boxSizer); - } - - void BalancePanel::UpdateStuff(Api* api) - { - if (api->IsLoggedIn()) - { - try - { - lblBalanceAmount->SetAmount(api->GetBalance()); - } - catch (const std::exception &e) - { - wxCommandEvent* evt = new wxCommandEvent(EVT_API_ERROR); - evt->SetEventObject(this); - evt->SetString("Balance update failed!"); - QueueEvent(evt); - } - } - else - { - lblBalanceAmount->SetAmount(0); - } - } -} diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index c991110..642dc83 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -2,14 +2,11 @@ project(ui) add_library(${PROJECT_NAME} STATIC App.cpp - BalancePanel.cpp - EventPositionPanel.cpp ExchangeAnnouncementsDialog.cpp ExchangeScheduleDialog.cpp ExchangeStatusDialog.cpp LoginDialog.cpp MainFrame.cpp - MarketPositionPanel.cpp PortfolioPanel.cpp StaticCurrency.cpp event.cpp @@ -25,6 +22,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC api config + wxfb PRIVATE OpenGL::EGL wx::core diff --git a/src/ui/EventPositionPanel.cpp b/src/ui/EventPositionPanel.cpp deleted file mode 100644 index 7df4731..0000000 --- a/src/ui/EventPositionPanel.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include - -#include - -#include - -#include "api/types.hpp" -#include "ui/EventPositionPanel.hpp" -#include "ui/StaticCurrency.hpp" - -namespace kdeck -{ - // constructor //////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// - - EventPositionPanel::EventPositionPanel(wxWindow* parent, wxWindowID winid, std::shared_ptr event) - : wxPanel(parent, winid) - , event{event} - { - Setup(); - } - - // init /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// - - void EventPositionPanel::Setup() - { - wxStaticText* lblTicker = new wxStaticText(this, wxID_ANY, *event->event_ticker); - wxStaticText* lblBlank = new wxStaticText(this, wxID_ANY, ""); - StaticCurrency* lblExposure = new StaticCurrency(this, wxID_ANY, *event->event_exposure); - StaticCurrency* lblRealizedPnL = new StaticCurrency(this, wxID_ANY, *event->realized_pnl); - StaticCurrency* lblTotalTraded = new StaticCurrency(this, wxID_ANY, *event->total_cost); - wxStaticText* lblRestingOrders = new wxStaticText(this, wxID_ANY, std::to_string(*event->resting_order_count)); - - wxGridSizer* gridSizer = new wxGridSizer(6, wxSize{10, 0}); - - wxSizerFlags flagsLblLeft = wxSizerFlags().CenterVertical().Left(); - wxSizerFlags flagsLblRight = wxSizerFlags().CenterVertical().Right(); - - gridSizer->Add(lblTicker, flagsLblLeft); - gridSizer->Add(lblBlank, flagsLblRight); - gridSizer->Add(lblExposure, flagsLblRight); - gridSizer->Add(lblRealizedPnL, flagsLblRight); - gridSizer->Add(lblTotalTraded, flagsLblRight); - gridSizer->Add(lblRestingOrders, flagsLblRight); - - SetSizerAndFit(gridSizer); - } -} diff --git a/src/ui/ExchangeAnnouncementsDialog.cpp b/src/ui/ExchangeAnnouncementsDialog.cpp index 0e74f6e..f4e4616 100644 --- a/src/ui/ExchangeAnnouncementsDialog.cpp +++ b/src/ui/ExchangeAnnouncementsDialog.cpp @@ -1,5 +1,7 @@ #include +#include "App.h" // wxfb + #include "api/Api.hpp" #include "ui/ExchangeAnnouncementsDialog.hpp" #include "ui/event.hpp" @@ -11,66 +13,34 @@ namespace kdeck // constructor //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// - ExchangeAnnouncementsDialog::ExchangeAnnouncementsDialog(wxWindow* parent, wxWindowID winid, const wxString &title) - : wxDialog(parent, winid, title) + ExchangeAnnouncementsDialog::ExchangeAnnouncementsDialog(wxWindow* parent, wxWindowID winid) + : wxfb::ExchangeAnnouncementsDialog(parent, winid) { - Setup(); - } - - // init /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// - - void ExchangeAnnouncementsDialog::Setup() - { - boxSizer = new wxBoxSizer(wxVERTICAL); - - wxBoxSizer* szr = new wxBoxSizer(wxVERTICAL); - - szr->Add(boxSizer, wxSizerFlags().Border(wxALL, 10).Expand()); - - wxSizer* szrButton = CreateButtonSizer(wxOK); - if (szrButton) - { - szr->Add(szrButton, wxSizerFlags().Center()); - } - SetSizerAndFit(szr); - //TODO? messages have arbitrary length, so we should probably set a max size; - // wxWidgets complains if max size is less than the sizer's minimum size - // (look in git log for how I reconciled these previously) - //SetMaxSize(wxSize{800, 0}); } void ExchangeAnnouncementsDialog::UpdateStuff(Api* api) { - boxSizer->Clear(); + fgszrAnnouncements->Clear(); try { std::shared_ptr announcements = api->GetExchangeAnnouncements(); - if (announcements->announcements->empty()) - { - boxSizer->Add(new wxStaticText(this, wxID_ANY, "No announcements."), wxSizerFlags().Center()); - } - else - { - wxSizerFlags flags = wxSizerFlags().Border(wxUP | wxDOWN, 10).Expand(); + bool hasAnnouncements = !announcements->announcements->empty(); - for (auto announcement : *announcements->announcements) - { - wxBoxSizer* szr = new wxBoxSizer(wxHORIZONTAL); + fgszrAnnouncements->Show(hasAnnouncements); - wxSizerFlags flagsLbl = wxSizerFlags().Border(wxLEFT, 10).CenterVertical(); - - szr->Add(new wxStaticText(this, wxID_ANY, announcement->delivery_time->c_str()), flagsLbl); - szr->Add(new wxStaticText(this, wxID_ANY, announcement->status->c_str()), flagsLbl); - szr->Add(new wxStaticText(this, wxID_ANY, announcement->type->c_str()), flagsLbl); - szr->Add(new wxStaticText(this, wxID_ANY, announcement->message->c_str()), flagsLbl); - - boxSizer->Add(szr, flags); - } + wxSizerFlags flagsLbl = wxSizerFlags().Border(wxLEFT, 10).CenterVertical(); + for (auto announcement : *announcements->announcements) + { + fgszrAnnouncements->Add(new wxStaticText(this, wxID_ANY, announcement->delivery_time->c_str()), flagsLbl); + fgszrAnnouncements->Add(new wxStaticText(this, wxID_ANY, announcement->status->c_str()), flagsLbl); + fgszrAnnouncements->Add(new wxStaticText(this, wxID_ANY, announcement->type->c_str()), flagsLbl); + fgszrAnnouncements->Add(new wxStaticText(this, wxID_ANY, announcement->message->c_str()), flagsLbl); } + + lblNoAnnouncements->Show(!hasAnnouncements); } catch (const std::exception &e) { diff --git a/src/ui/ExchangeScheduleDialog.cpp b/src/ui/ExchangeScheduleDialog.cpp index 5de7349..eeb7972 100644 --- a/src/ui/ExchangeScheduleDialog.cpp +++ b/src/ui/ExchangeScheduleDialog.cpp @@ -1,6 +1,8 @@ #include #include +#include "App.h" // wxfb + #include "api/Api.hpp" #include "ui/ExchangeScheduleDialog.hpp" #include "ui/event.hpp" @@ -12,89 +14,15 @@ namespace kdeck // constructor //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// - ExchangeScheduleDialog::ExchangeScheduleDialog(wxWindow* parent, wxWindowID winid, const wxString &title) - : wxDialog(parent, winid, title) - { - Setup(); - } - - // init /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// - - void ExchangeScheduleDialog::Setup() + ExchangeScheduleDialog::ExchangeScheduleDialog(wxWindow* parent, wxWindowID winid) + : wxfb::ExchangeScheduleDialog(parent, winid) { - wxStaticText* lblSunday = new wxStaticText(this, wxID_ANY, "Sunday:"); - lblSundaySchedule = new wxStaticText(this, wxID_ANY, ""); - - wxStaticText* lblMonday = new wxStaticText(this, wxID_ANY, "Monday:"); - lblMondaySchedule = new wxStaticText(this, wxID_ANY, ""); - - wxStaticText* lblTuesday = new wxStaticText(this, wxID_ANY, "Tuesday:"); - lblTuesdaySchedule = new wxStaticText(this, wxID_ANY, ""); - - wxStaticText* lblWednesday = new wxStaticText(this, wxID_ANY, "Wednesday:"); - lblWednesdaySchedule = new wxStaticText(this, wxID_ANY, ""); - - wxStaticText* lblThursday = new wxStaticText(this, wxID_ANY, "Thursday:"); - lblThursdaySchedule = new wxStaticText(this, wxID_ANY, ""); - - wxStaticText* lblFriday = new wxStaticText(this, wxID_ANY, "Friday:"); - lblFridaySchedule = new wxStaticText(this, wxID_ANY, ""); - - wxStaticText* lblSaturday = new wxStaticText(this, wxID_ANY, "Saturday:"); - lblSaturdaySchedule = new wxStaticText(this, wxID_ANY, ""); - - /////////////////////////////////////////////////////////////////////////// - - wxGridSizer* gridSizer = new wxGridSizer(7, 2, wxSize{10, 10}); - - wxSizerFlags flagsLblLeft = wxSizerFlags().CenterVertical().Left(); - wxSizerFlags flagsLblRight = wxSizerFlags().CenterVertical().Right(); - - gridSizer->Add(lblSunday, flagsLblRight); - gridSizer->Add(lblSundaySchedule, flagsLblLeft); - - gridSizer->Add(lblMonday, flagsLblRight); - gridSizer->Add(lblMondaySchedule, flagsLblLeft); - - gridSizer->Add(lblTuesday, flagsLblRight); - gridSizer->Add(lblTuesdaySchedule, flagsLblLeft); - - gridSizer->Add(lblWednesday, flagsLblRight); - gridSizer->Add(lblWednesdaySchedule, flagsLblLeft); - gridSizer->Add(lblThursday, flagsLblRight); - gridSizer->Add(lblThursdaySchedule, flagsLblLeft); - - gridSizer->Add(lblFriday, flagsLblRight); - gridSizer->Add(lblFridaySchedule, flagsLblLeft); - - gridSizer->Add(lblSaturday, flagsLblRight); - gridSizer->Add(lblSaturdaySchedule, flagsLblLeft); - - /////////////////////////////////////////////////////////////////////////// - - boxSizer = new wxBoxSizer(wxVERTICAL); - - wxBoxSizer* szr = new wxBoxSizer(wxVERTICAL); - - wxSizerFlags flags = wxSizerFlags().Border(wxALL, 10).Expand(); - - szr->Add(gridSizer, flags); - szr->Add(boxSizer, flags); - - wxSizer* szrButton = CreateButtonSizer(wxOK); - if (szrButton) - { - szr->Add(szrButton, wxSizerFlags().Center()); - } - - SetSizerAndFit(szr); } void ExchangeScheduleDialog::UpdateStuff(Api* api) { - boxSizer->Clear(); + gszrMaintenanceSchedule->Clear(); try { @@ -108,30 +36,20 @@ namespace kdeck lblFridaySchedule->SetLabel(wxString::Format(L"%s—%s ET", schedule->schedule->standard_hours->friday->open_time->c_str(), schedule->schedule->standard_hours->friday->close_time->c_str())); lblSaturdaySchedule->SetLabel(wxString::Format(L"%s—%s ET", schedule->schedule->standard_hours->saturday->open_time->c_str(), schedule->schedule->standard_hours->saturday->close_time->c_str())); - if (schedule->schedule->maintenance_windows->empty()) - { - boxSizer->Add(new wxStaticText(this, wxID_ANY, "No scheduled maintenance closures."), wxSizerFlags().Center()); - } - else - { - boxSizer->Add(new wxStaticText(this, wxID_ANY, "Scheduled maintenance closures:"), wxSizerFlags().Center()); - - wxGridSizer* gridSizer = new wxGridSizer(0, 2, wxSize{10, 10}); + bool hasMaintenanceScheduled = !schedule->schedule->maintenance_windows->empty(); - wxSizerFlags flagsLblCenter = wxSizerFlags().CenterVertical().Center(); - wxSizerFlags flagsLblLeft = wxSizerFlags().CenterVertical().Left(); + lblScheduledMaintenance->Show(hasMaintenanceScheduled); + gszrMaintenanceScheduleColumns->Show(hasMaintenanceScheduled); + gszrMaintenanceSchedule->Show(hasMaintenanceScheduled); - gridSizer->Add(new wxStaticText(this, wxID_ANY, "Start"), flagsLblCenter); - gridSizer->Add(new wxStaticText(this, wxID_ANY, "End"), flagsLblCenter); - - for (auto maint : *schedule->schedule->maintenance_windows) - { - gridSizer->Add(new wxStaticText(this, wxID_ANY, maint->start_datetime->c_str()), flagsLblLeft); - gridSizer->Add(new wxStaticText(this, wxID_ANY, maint->end_datetime->c_str()), flagsLblLeft); - } - - boxSizer->Add(gridSizer); + wxSizerFlags flagsLblLeft = wxSizerFlags().CenterVertical().Left(); + for (auto maint : *schedule->schedule->maintenance_windows) + { + gszrMaintenanceSchedule->Add(new wxStaticText(this, wxID_ANY, maint->start_datetime->c_str()), flagsLblLeft); + gszrMaintenanceSchedule->Add(new wxStaticText(this, wxID_ANY, maint->end_datetime->c_str()), flagsLblLeft); } + + lblNoScheduledMaintenance->Show(!hasMaintenanceScheduled); } catch (const std::exception &e) { diff --git a/src/ui/ExchangeStatusDialog.cpp b/src/ui/ExchangeStatusDialog.cpp index ad4773a..dff7ac9 100644 --- a/src/ui/ExchangeStatusDialog.cpp +++ b/src/ui/ExchangeStatusDialog.cpp @@ -11,49 +11,10 @@ namespace kdeck // constructor //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// - ExchangeStatusDialog::ExchangeStatusDialog(wxWindow* parent, wxWindowID winid, const wxString &title) - : wxDialog(parent, winid, title) + ExchangeStatusDialog::ExchangeStatusDialog(wxWindow* parent, wxWindowID winid) + : wxfb::ExchangeStatusDialog(parent, winid) { - Setup(); - } - - // init /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// - - void ExchangeStatusDialog::Setup() - { - wxStaticText* lblExchange = new wxStaticText(this, wxID_ANY, "Exchange:"); - lblExchangeStatus = new wxStaticText(this, wxID_ANY, ""); - - wxStaticText* lblTrading = new wxStaticText(this, wxID_ANY, "Trading:"); - lblTradingStatus = new wxStaticText(this, wxID_ANY, ""); - - /////////////////////////////////////////////////////////////////////////// - - wxGridSizer* gridSizer = new wxGridSizer(2, 2, wxSize{10, 10}); - - wxSizerFlags flagsLblLeft = wxSizerFlags().CenterVertical().Left(); - wxSizerFlags flagsLblRight = wxSizerFlags().CenterVertical().Right(); - - gridSizer->Add(lblExchange, flagsLblRight); - gridSizer->Add(lblExchangeStatus, flagsLblLeft); - - gridSizer->Add(lblTrading, flagsLblRight); - gridSizer->Add(lblTradingStatus, flagsLblLeft); - - /////////////////////////////////////////////////////////////////////////// - - wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL); - - boxSizer->Add(gridSizer, wxSizerFlags().Border(wxALL, 10).Expand()); - - wxSizer* szrButton = CreateButtonSizer(wxOK); - if (szrButton) - { - boxSizer->Add(szrButton, wxSizerFlags().Center()); - } - SetSizerAndFit(boxSizer); } void ExchangeStatusDialog::UpdateStuff(Api* api) diff --git a/src/ui/LoginDialog.cpp b/src/ui/LoginDialog.cpp index a16a55e..d549130 100644 --- a/src/ui/LoginDialog.cpp +++ b/src/ui/LoginDialog.cpp @@ -1,5 +1,7 @@ #include +#include "App.h" // wxfb + #include "config/Config.hpp" #include "ui/LoginDialog.hpp" #include "ui/event.hpp" @@ -9,44 +11,15 @@ namespace kdeck // constructor //////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// - LoginDialog::LoginDialog(wxWindow* parent, wxWindowID winid, const wxString &title) - : wxDialog(parent, winid, title) + LoginDialog::LoginDialog(wxWindow* parent, wxWindowID winid) + : wxfb::LoginDialog(parent, winid) { - Setup(); + } // init /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// - void LoginDialog::Setup() - { - txtEmail = new wxTextCtrl(this, wxID_ANY); - txtEmail->SetHint("Email"); - txtEmail->SetFocus(); - - txtPassword = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD); - txtPassword->SetHint("Password"); - - chkRememberMe = new wxCheckBox(this, wxID_ANY, "Remember me"); - chkRememberMe->SetValue(false); - - wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL); - - wxSizerFlags flagsInput = wxSizerFlags().Border(wxALL, 10).Expand(); - - boxSizer->Add(txtEmail, flagsInput); - boxSizer->Add(txtPassword, flagsInput); - boxSizer->Add(chkRememberMe, flagsInput); - - wxSizer* szrButton = CreateButtonSizer(wxOK | wxCANCEL); - if (szrButton) - { - boxSizer->Add(szrButton, wxSizerFlags().Center()); - } - - SetSizerAndFit(boxSizer); - } - void LoginDialog::UpdateStuff(const Config* config) { if (config->GetEmail().empty()) diff --git a/src/ui/MainFrame.cpp b/src/ui/MainFrame.cpp index 22c7b12..de0d196 100644 --- a/src/ui/MainFrame.cpp +++ b/src/ui/MainFrame.cpp @@ -3,6 +3,8 @@ #include #include +#include "App.h" // wxfb + #include "api/Api.hpp" #include "config/Config.hpp" #include "ui/ExchangeAnnouncementsDialog.hpp" @@ -10,7 +12,6 @@ #include "ui/ExchangeStatusDialog.hpp" #include "ui/MainFrame.hpp" #include "ui/LoginDialog.hpp" -#include "ui/PortfolioPanel.hpp" #include "ui/event.hpp" namespace kdeck @@ -19,7 +20,7 @@ namespace kdeck /////////////////////////////////////////////////////////////////////////////// MainFrame::MainFrame(wxWindow* parent, wxWindowID winid, const wxString &title) - : wxFrame(parent, winid, title) + : wxfb::MainFrame(parent, winid, title) , config{} , api{config.GetKalshiApiUrl(), config.GetSslTrustStoreDir()} { @@ -31,68 +32,11 @@ namespace kdeck void MainFrame::Setup() { - // NOTE: It appears to be important that we add the status bar (and possibly - // the menu bar) before we add a panel/sizer. It seems to change the - // dimensions of the panel/frame and messes with sizer logic. - - wxMenu *menuFile = new wxMenu; - - mnuLogin = menuFile->Append(ID_Login, "Login...", "Login"); - mnuLogout = menuFile->Append(ID_Logout, "Logout...", "Logout"); - - mnuLogout->Enable(false); - - menuFile->AppendSeparator(); - menuFile->Append(wxID_EXIT); - - /////////////////////////////////////////////////////////////////////////// - - wxMenu *menuExchange = new wxMenu; - - menuExchange->Append(ID_Exchange_Announcements, "Announcements", "Announcements"); - menuExchange->Append(ID_Exchange_Schedule, "Schedule", "Schedule"); - menuExchange->Append(ID_Exchange_Status, "Status", "Status"); - - /////////////////////////////////////////////////////////////////////////// - - wxMenu *menuView = new wxMenu; - - mnuShowClosedPositions = menuView->AppendCheckItem(ID_View_ShowClosedPositions, "Show Closed Positions", "Show Closed Positions"); - - mnuShowClosedPositions->Enable(false); - - /////////////////////////////////////////////////////////////////////////// - - wxMenu *menuHelp = new wxMenu; - menuHelp->Append(wxID_ABOUT); - - /////////////////////////////////////////////////////////////////////////// - - wxMenuBar *menuBar = new wxMenuBar; - menuBar->Append(menuFile, "&File"); - menuBar->Append(menuExchange, "&Exchange"); - menuBar->Append(menuView, "&View"); - menuBar->Append(menuHelp, "&Help"); - - SetMenuBar(menuBar); - - /////////////////////////////////////////////////////////////////////////// - - CreateStatusBar(3); ShowStatus(wxString::Format("Welcome to %s!", kProjectName)); - /////////////////////////////////////////////////////////////////////////// - - pnlPortfolio = new PortfolioPanel(this); - - SetMinSize(wxSize{400, 400}); - Bind(EVT_LOGIN, &MainFrame::OnLoginOrLogout, this); Bind(EVT_LOGOUT, &MainFrame::OnLoginOrLogout, this); Bind(EVT_API_ERROR, &MainFrame::OnApiError, this); - Bind(wxEVT_IDLE, &MainFrame::OnIdleRunOnce, this); - Bind(wxEVT_MENU, &MainFrame::OnMenuItemSelected, this); - Bind(wxEVT_CLOSE_WINDOW, &MainFrame::OnClose, this); } void MainFrame::UpdateStuff() @@ -221,12 +165,14 @@ namespace kdeck ShowStatus(event.GetString()); } - void MainFrame::OnIdleRunOnce(wxIdleEvent &event) + void MainFrame::OnShow(wxShowEvent &event) { - // unbind this event handler so it only runs once - Unbind(wxEVT_IDLE, &MainFrame::OnIdleRunOnce, this); + if (!isLoginDialogShownOnce) + { + isLoginDialogShownOnce = true; - DoLogin(); + DoLogin(); + } } void MainFrame::OnMenuItemSelected(wxCommandEvent &event) diff --git a/src/ui/MarketPositionPanel.cpp b/src/ui/MarketPositionPanel.cpp deleted file mode 100644 index 98684cd..0000000 --- a/src/ui/MarketPositionPanel.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include - -#include - -#include -#include - -#include "api/types.hpp" -#include "ui/MarketPositionPanel.hpp" -#include "ui/StaticCurrency.hpp" - -namespace kdeck -{ - // constructor //////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// - - MarketPositionPanel::MarketPositionPanel(wxWindow* parent, wxWindowID winid, std::shared_ptr market) - : wxPanel(parent, winid) - , market{market} - { - Setup(); - } - - // init /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////// - - void MarketPositionPanel::Setup() - { - wxStaticText* lblTicker = new wxStaticText(this, wxID_ANY, *market->ticker); - - wxStaticText* lblPosition; - if (market->position > 0) - { - lblPosition = new wxStaticText(this, wxID_ANY, wxString::Format("Yes %d", std::abs(*market->position))); - } - else - { - lblPosition = new wxStaticText(this, wxID_ANY, wxString::Format("No %d", std::abs(*market->position))); - } - - StaticCurrency* lblExposure = new StaticCurrency(this, wxID_ANY, *market->market_exposure); - StaticCurrency* lblRealizedPnL = new StaticCurrency(this, wxID_ANY, *market->realized_pnl); - StaticCurrency* lblTotalTraded = new StaticCurrency(this, wxID_ANY, *market->total_traded); - wxStaticText* lblRestingOrders = new wxStaticText(this, wxID_ANY, std::to_string(*market->resting_orders_count)); - - wxGridSizer* gridSizer = new wxGridSizer(6, wxSize{10, 0}); - - wxSizerFlags flagsLblLeft = wxSizerFlags().CenterVertical().Left(); - wxSizerFlags flagsLblRight = wxSizerFlags().CenterVertical().Right(); - - gridSizer->Add(lblTicker, flagsLblLeft); - gridSizer->Add(lblPosition, flagsLblRight); - gridSizer->Add(lblExposure, flagsLblRight); - gridSizer->Add(lblRealizedPnL, flagsLblRight); - gridSizer->Add(lblTotalTraded, flagsLblRight); - gridSizer->Add(lblRestingOrders, flagsLblRight); - - SetSizerAndFit(gridSizer); - } -} diff --git a/src/ui/PortfolioPanel.cpp b/src/ui/PortfolioPanel.cpp index aa6e42b..c6c6c7c 100644 --- a/src/ui/PortfolioPanel.cpp +++ b/src/ui/PortfolioPanel.cpp @@ -1,11 +1,10 @@ #include +#include "PortfolioPanel.h" // wxfb + #include "api/Api.hpp" #include "config/Config.hpp" -#include "ui/BalancePanel.hpp" #include "ui/PortfolioPanel.hpp" -#include "ui/EventPositionPanel.hpp" -#include "ui/MarketPositionPanel.hpp" #include "ui/event.hpp" namespace kdeck @@ -14,47 +13,28 @@ namespace kdeck /////////////////////////////////////////////////////////////////////////////// PortfolioPanel::PortfolioPanel(wxWindow* parent, wxWindowID winid) - : wxScrolledWindow(parent, winid) + : wxfb::PortfolioPanel(parent, winid) { - Setup(); + } // init /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// - void PortfolioPanel::Setup() - { - pnlBalance = new BalancePanel(this); - - pnlPositions = new wxPanel(this); - - wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL); - - wxSizerFlags flags = wxSizerFlags().Border(wxALL, 10).Expand(); - - boxSizer->Add(pnlBalance, flags); - boxSizer->Add(pnlPositions, flags); - - SetSizerAndFit(boxSizer); - SetScrollRate(10, 10); - } - void PortfolioPanel::UpdateStuff(const Config* config, Api* api) { - pnlBalance->UpdateStuff(api); - pnlPositions->DestroyChildren(); if (api->IsLoggedIn()) { try { - api->GetPositions(); - - wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL); + lblBalanceAmount->SetAmount(api->GetBalance()); - wxSizerFlags flags = wxSizerFlags().Border(wxUP | wxDOWN, 10).Expand(); + api->GetPositions(); + wxSizerFlags flagsLblLeft = wxSizerFlags().CenterVertical().Left(); + wxSizerFlags flagsLblRight = wxSizerFlags().CenterVertical().Right(); for (auto event : api->GetEventPositions()) { if (0 == *event->event_exposure && !config->GetShowClosedPositions()) @@ -62,7 +42,19 @@ namespace kdeck continue; } - boxSizer->Add(new EventPositionPanel(pnlPositions, wxID_ANY, event), flags); + wxStaticText* lblTicker = new wxStaticText(pnlPositions, wxID_ANY, *event->event_ticker); + wxStaticText* lblBlank = new wxStaticText(pnlPositions, wxID_ANY, ""); + StaticCurrency* lblExposure = new StaticCurrency(pnlPositions, wxID_ANY, *event->event_exposure); + StaticCurrency* lblRealizedPnL = new StaticCurrency(pnlPositions, wxID_ANY, *event->realized_pnl); + StaticCurrency* lblTotalTraded = new StaticCurrency(pnlPositions, wxID_ANY, *event->total_cost); + wxStaticText* lblRestingOrders = new wxStaticText(pnlPositions, wxID_ANY, std::to_string(*event->resting_order_count)); + + fgszrPositions->Add(lblTicker, flagsLblLeft); + fgszrPositions->Add(lblBlank, flagsLblRight); + fgszrPositions->Add(lblExposure, flagsLblRight); + fgszrPositions->Add(lblRealizedPnL, flagsLblRight); + fgszrPositions->Add(lblTotalTraded, flagsLblRight); + fgszrPositions->Add(lblRestingOrders, flagsLblRight); for (auto market : api->GetMarketPositions(*event->event_ticker)) { @@ -71,11 +63,31 @@ namespace kdeck continue; } - boxSizer->Add(new MarketPositionPanel(pnlPositions, wxID_ANY, market), flags); + wxStaticText* lblTicker = new wxStaticText(pnlPositions, wxID_ANY, *market->ticker); + + wxStaticText* lblPosition; + if (market->position > 0) + { + lblPosition = new wxStaticText(pnlPositions, wxID_ANY, wxString::Format("Yes %d", std::abs(*market->position))); + } + else + { + lblPosition = new wxStaticText(pnlPositions, wxID_ANY, wxString::Format("No %d", std::abs(*market->position))); + } + + StaticCurrency* lblExposure = new StaticCurrency(pnlPositions, wxID_ANY, *market->market_exposure); + StaticCurrency* lblRealizedPnL = new StaticCurrency(pnlPositions, wxID_ANY, *market->realized_pnl); + StaticCurrency* lblTotalTraded = new StaticCurrency(pnlPositions, wxID_ANY, *market->total_traded); + wxStaticText* lblRestingOrders = new wxStaticText(pnlPositions, wxID_ANY, std::to_string(*market->resting_orders_count)); + + fgszrPositions->Add(lblTicker, flagsLblLeft); + fgszrPositions->Add(lblPosition, flagsLblRight); + fgszrPositions->Add(lblExposure, flagsLblRight); + fgszrPositions->Add(lblRealizedPnL, flagsLblRight); + fgszrPositions->Add(lblTotalTraded, flagsLblRight); + fgszrPositions->Add(lblRestingOrders, flagsLblRight); } } - - pnlPositions->SetSizerAndFit(boxSizer); } catch (const std::exception &e) { @@ -85,5 +97,11 @@ namespace kdeck QueueEvent(evt); } } + else + { + lblBalanceAmount->SetAmount(0); + } + + Layout(); } } diff --git a/src/wxfb/App.cpp b/src/wxfb/App.cpp new file mode 100644 index 0000000..b5e7810 --- /dev/null +++ b/src/wxfb/App.cpp @@ -0,0 +1,392 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-33-g6494dcef) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "App.h" + +/////////////////////////////////////////////////////////////////////////// +using namespace kdeck::wxfb; + +MainFrame::MainFrame() +{ +} + +MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) +{ + this->Create( parent, id, title, pos, size, style ); +} + +bool MainFrame::Create( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) +{ + if ( !wxFrame::Create( parent, id, title, pos, size, style ) ) + { + return false; + } + + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* vszrRoot; + vszrRoot = new wxBoxSizer( wxVERTICAL ); + + pnlRoot = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* vszrContent; + vszrContent = new wxBoxSizer( wxVERTICAL ); + + pnlPortfolio = new kdeck::PortfolioPanel(pnlRoot); + vszrContent->Add( pnlPortfolio, 1, wxALL|wxEXPAND, 5 ); + + + pnlRoot->SetSizer( vszrContent ); + pnlRoot->Layout(); + vszrContent->Fit( pnlRoot ); + vszrRoot->Add( pnlRoot, 1, wxEXPAND | wxALL, 5 ); + + + this->SetSizer( vszrRoot ); + this->Layout(); + mnuBar = new wxMenuBar( 0 ); + mnuFile = new wxMenu(); + mnuLogin = new wxMenuItem( mnuFile, ID_Login, wxString( _("Login...") ) , _("Login"), wxITEM_NORMAL ); + mnuFile->Append( mnuLogin ); + + mnuLogout = new wxMenuItem( mnuFile, ID_Logout, wxString( _("Logout...") ) , _("Logout"), wxITEM_NORMAL ); + mnuFile->Append( mnuLogout ); + mnuLogout->Enable( false ); + + mnuFile->AppendSeparator(); + + wxMenuItem* mnuExit; + mnuExit = new wxMenuItem( mnuFile, wxID_EXIT, wxString( wxEmptyString ) , wxEmptyString, wxITEM_NORMAL ); + mnuFile->Append( mnuExit ); + + mnuBar->Append( mnuFile, _("&File") ); + + mnuExchange = new wxMenu(); + wxMenuItem* mnuItemExchangeAnnouncements; + mnuItemExchangeAnnouncements = new wxMenuItem( mnuExchange, ID_Exchange_Announcements, wxString( _("Announcements") ) , _("Announcements"), wxITEM_NORMAL ); + mnuExchange->Append( mnuItemExchangeAnnouncements ); + + wxMenuItem* mnuItemExchangeSchedule; + mnuItemExchangeSchedule = new wxMenuItem( mnuExchange, ID_Exchange_Schedule, wxString( _("Schedule") ) , _("Schedule"), wxITEM_NORMAL ); + mnuExchange->Append( mnuItemExchangeSchedule ); + + wxMenuItem* mnuItemExchangeStatus; + mnuItemExchangeStatus = new wxMenuItem( mnuExchange, ID_Exchange_Status, wxString( _("Status") ) , _("Status"), wxITEM_NORMAL ); + mnuExchange->Append( mnuItemExchangeStatus ); + + mnuBar->Append( mnuExchange, _("&Exchange") ); + + mnuView = new wxMenu(); + mnuShowClosedPositions = new wxMenuItem( mnuView, ID_View_ShowClosedPositions, wxString( _("Show Closed Positions") ) , _("Show Closed Positions"), wxITEM_CHECK ); + mnuView->Append( mnuShowClosedPositions ); + mnuShowClosedPositions->Enable( false ); + + mnuBar->Append( mnuView, _("&View") ); + + mnuHelp = new wxMenu(); + wxMenuItem* mnuAbout; + mnuAbout = new wxMenuItem( mnuHelp, wxID_ABOUT, wxString( wxEmptyString ) , wxEmptyString, wxITEM_NORMAL ); + mnuHelp->Append( mnuAbout ); + + mnuBar->Append( mnuHelp, _("&Help") ); + + this->SetMenuBar( mnuBar ); + + statusBar = this->CreateStatusBar( 3, wxSTB_SIZEGRIP, wxID_ANY ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainFrame::OnClose ) ); + this->Connect( wxEVT_SHOW, wxShowEventHandler( MainFrame::OnShow ) ); + mnuFile->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnMenuItemSelected ), this, mnuLogin->GetId()); + mnuFile->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnMenuItemSelected ), this, mnuLogout->GetId()); + mnuFile->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnMenuItemSelected ), this, mnuExit->GetId()); + mnuExchange->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnMenuItemSelected ), this, mnuItemExchangeAnnouncements->GetId()); + mnuExchange->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnMenuItemSelected ), this, mnuItemExchangeSchedule->GetId()); + mnuExchange->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnMenuItemSelected ), this, mnuItemExchangeStatus->GetId()); + mnuView->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnMenuItemSelected ), this, mnuShowClosedPositions->GetId()); + mnuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnMenuItemSelected ), this, mnuAbout->GetId()); + + return true; +} + +MainFrame::~MainFrame() +{ +} + +LoginDialog::LoginDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* vszrContent; + vszrContent = new wxBoxSizer( wxVERTICAL ); + + wxGridSizer* gszrInputs; + gszrInputs = new wxGridSizer( 0, 2, 0, 0 ); + + wxStaticText* lblEmail; + lblEmail = new wxStaticText( this, wxID_ANY, _("Email"), wxDefaultPosition, wxDefaultSize, 0 ); + lblEmail->Wrap( -1 ); + gszrInputs->Add( lblEmail, 0, wxALIGN_RIGHT|wxALL, 5 ); + + txtEmail = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gszrInputs->Add( txtEmail, 0, wxALL|wxEXPAND, 5 ); + + wxStaticText* lblPassword; + lblPassword = new wxStaticText( this, wxID_ANY, _("Password"), wxDefaultPosition, wxDefaultSize, 0 ); + lblPassword->Wrap( -1 ); + gszrInputs->Add( lblPassword, 0, wxALIGN_RIGHT|wxALL, 5 ); + + txtPassword = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD ); + gszrInputs->Add( txtPassword, 0, wxALL|wxEXPAND, 5 ); + + + vszrContent->Add( gszrInputs, 1, wxEXPAND, 5 ); + + chkRememberMe = new wxCheckBox( this, wxID_ANY, _("Remember me"), wxDefaultPosition, wxDefaultSize, 0 ); + vszrContent->Add( chkRememberMe, 0, wxALL, 5 ); + + wxStdDialogButtonSizer* szrStandardButtons; + wxButton* szrStandardButtonsOK; + wxButton* szrStandardButtonsCancel; + szrStandardButtons = new wxStdDialogButtonSizer(); + szrStandardButtonsOK = new wxButton( this, wxID_OK ); + szrStandardButtons->AddButton( szrStandardButtonsOK ); + szrStandardButtonsCancel = new wxButton( this, wxID_CANCEL ); + szrStandardButtons->AddButton( szrStandardButtonsCancel ); + szrStandardButtons->Realize(); + + vszrContent->Add( szrStandardButtons, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + + this->SetSizer( vszrContent ); + this->Layout(); + vszrContent->Fit( this ); + + this->Centre( wxBOTH ); +} + +LoginDialog::~LoginDialog() +{ +} + +ExchangeAnnouncementsDialog::ExchangeAnnouncementsDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* vszrContent; + vszrContent = new wxBoxSizer( wxVERTICAL ); + + fgszrAnnouncements = new wxFlexGridSizer( 1, 4, 0, 0 ); + fgszrAnnouncements->AddGrowableCol( 3 ); + fgszrAnnouncements->SetFlexibleDirection( wxBOTH ); + fgszrAnnouncements->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + vszrContent->Add( fgszrAnnouncements, 1, wxEXPAND, 5 ); + + lblNoAnnouncements = new wxStaticText( this, wxID_ANY, _("There are no announcements."), wxDefaultPosition, wxDefaultSize, 0 ); + lblNoAnnouncements->Wrap( -1 ); + vszrContent->Add( lblNoAnnouncements, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + wxStdDialogButtonSizer* szrStandardButtons; + wxButton* szrStandardButtonsOK; + szrStandardButtons = new wxStdDialogButtonSizer(); + szrStandardButtonsOK = new wxButton( this, wxID_OK ); + szrStandardButtons->AddButton( szrStandardButtonsOK ); + szrStandardButtons->Realize(); + + vszrContent->Add( szrStandardButtons, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + + this->SetSizer( vszrContent ); + this->Layout(); + vszrContent->Fit( this ); + + this->Centre( wxBOTH ); +} + +ExchangeAnnouncementsDialog::~ExchangeAnnouncementsDialog() +{ +} + +ExchangeScheduleDialog::ExchangeScheduleDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* vszrContent; + vszrContent = new wxBoxSizer( wxVERTICAL ); + + wxGridSizer* gszrSchedule; + gszrSchedule = new wxGridSizer( 0, 2, 0, 0 ); + + wxStaticText* lblSunday; + lblSunday = new wxStaticText( this, wxID_ANY, _("Sunday"), wxDefaultPosition, wxDefaultSize, 0 ); + lblSunday->Wrap( -1 ); + gszrSchedule->Add( lblSunday, 0, wxALIGN_RIGHT|wxALL, 5 ); + + lblSundaySchedule = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + lblSundaySchedule->Wrap( -1 ); + gszrSchedule->Add( lblSundaySchedule, 0, wxALIGN_LEFT|wxALL, 5 ); + + wxStaticText* lblMonday; + lblMonday = new wxStaticText( this, wxID_ANY, _("Monday"), wxDefaultPosition, wxDefaultSize, 0 ); + lblMonday->Wrap( -1 ); + gszrSchedule->Add( lblMonday, 0, wxALIGN_RIGHT|wxALL, 5 ); + + lblMondaySchedule = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + lblMondaySchedule->Wrap( -1 ); + gszrSchedule->Add( lblMondaySchedule, 0, wxALL, 5 ); + + wxStaticText* lblTuesday; + lblTuesday = new wxStaticText( this, wxID_ANY, _("Tuesday"), wxDefaultPosition, wxDefaultSize, 0 ); + lblTuesday->Wrap( -1 ); + gszrSchedule->Add( lblTuesday, 0, wxALIGN_RIGHT|wxALL, 5 ); + + lblTuesdaySchedule = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + lblTuesdaySchedule->Wrap( -1 ); + gszrSchedule->Add( lblTuesdaySchedule, 0, wxALL, 5 ); + + wxStaticText* lblWednesday; + lblWednesday = new wxStaticText( this, wxID_ANY, _("Wednesday"), wxDefaultPosition, wxDefaultSize, 0 ); + lblWednesday->Wrap( -1 ); + gszrSchedule->Add( lblWednesday, 0, wxALIGN_RIGHT|wxALL, 5 ); + + lblWednesdaySchedule = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + lblWednesdaySchedule->Wrap( -1 ); + gszrSchedule->Add( lblWednesdaySchedule, 0, wxALL, 5 ); + + wxStaticText* lblThursday; + lblThursday = new wxStaticText( this, wxID_ANY, _("Thursday"), wxDefaultPosition, wxDefaultSize, 0 ); + lblThursday->Wrap( -1 ); + gszrSchedule->Add( lblThursday, 0, wxALIGN_RIGHT|wxALL, 5 ); + + lblThursdaySchedule = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + lblThursdaySchedule->Wrap( -1 ); + gszrSchedule->Add( lblThursdaySchedule, 0, wxALL, 5 ); + + wxStaticText* lblFriday; + lblFriday = new wxStaticText( this, wxID_ANY, _("Friday"), wxDefaultPosition, wxDefaultSize, 0 ); + lblFriday->Wrap( -1 ); + gszrSchedule->Add( lblFriday, 0, wxALIGN_RIGHT|wxALL, 5 ); + + lblFridaySchedule = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + lblFridaySchedule->Wrap( -1 ); + gszrSchedule->Add( lblFridaySchedule, 0, wxALL, 5 ); + + wxStaticText* lblSaturday; + lblSaturday = new wxStaticText( this, wxID_ANY, _("Saturday"), wxDefaultPosition, wxDefaultSize, 0 ); + lblSaturday->Wrap( -1 ); + gszrSchedule->Add( lblSaturday, 0, wxALIGN_RIGHT|wxALL, 5 ); + + lblSaturdaySchedule = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + lblSaturdaySchedule->Wrap( -1 ); + gszrSchedule->Add( lblSaturdaySchedule, 0, wxALL, 5 ); + + + vszrContent->Add( gszrSchedule, 1, wxEXPAND, 5 ); + + lblScheduledMaintenance = new wxStaticText( this, wxID_ANY, _("Scheduled Maintenance Closures"), wxDefaultPosition, wxDefaultSize, 0 ); + lblScheduledMaintenance->Wrap( -1 ); + vszrContent->Add( lblScheduledMaintenance, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + gszrMaintenanceScheduleColumns = new wxGridSizer( 0, 2, 0, 0 ); + + wxStaticText* lblStart; + lblStart = new wxStaticText( this, wxID_ANY, _("Start"), wxDefaultPosition, wxDefaultSize, 0 ); + lblStart->Wrap( -1 ); + gszrMaintenanceScheduleColumns->Add( lblStart, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + wxStaticText* m_staticText118; + m_staticText118 = new wxStaticText( this, wxID_ANY, _("End"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText118->Wrap( -1 ); + gszrMaintenanceScheduleColumns->Add( m_staticText118, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxLEFT, 5 ); + + + vszrContent->Add( gszrMaintenanceScheduleColumns, 0, wxEXPAND, 5 ); + + gszrMaintenanceSchedule = new wxGridSizer( 0, 2, 0, 0 ); + + + vszrContent->Add( gszrMaintenanceSchedule, 1, wxEXPAND, 5 ); + + lblNoScheduledMaintenance = new wxStaticText( this, wxID_ANY, _("There are no scheduled maintenance closures."), wxDefaultPosition, wxDefaultSize, 0 ); + lblNoScheduledMaintenance->Wrap( -1 ); + vszrContent->Add( lblNoScheduledMaintenance, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + wxStdDialogButtonSizer* szrStandardButtons; + wxButton* szrStandardButtonsOK; + szrStandardButtons = new wxStdDialogButtonSizer(); + szrStandardButtonsOK = new wxButton( this, wxID_OK ); + szrStandardButtons->AddButton( szrStandardButtonsOK ); + szrStandardButtons->Realize(); + + vszrContent->Add( szrStandardButtons, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + + this->SetSizer( vszrContent ); + this->Layout(); + vszrContent->Fit( this ); + + this->Centre( wxBOTH ); +} + +ExchangeScheduleDialog::~ExchangeScheduleDialog() +{ +} + +ExchangeStatusDialog::ExchangeStatusDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* vszrContent; + vszrContent = new wxBoxSizer( wxVERTICAL ); + + wxGridSizer* gszrStatus; + gszrStatus = new wxGridSizer( 0, 2, 0, 0 ); + + wxStaticText* lblExchange; + lblExchange = new wxStaticText( this, wxID_ANY, _("Exchange"), wxDefaultPosition, wxDefaultSize, 0 ); + lblExchange->Wrap( -1 ); + gszrStatus->Add( lblExchange, 0, wxALIGN_RIGHT|wxALL, 5 ); + + lblExchangeStatus = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + lblExchangeStatus->Wrap( -1 ); + gszrStatus->Add( lblExchangeStatus, 0, wxALL, 5 ); + + wxStaticText* lblTrading; + lblTrading = new wxStaticText( this, wxID_ANY, _("Trading"), wxDefaultPosition, wxDefaultSize, 0 ); + lblTrading->Wrap( -1 ); + gszrStatus->Add( lblTrading, 0, wxALIGN_RIGHT|wxALL, 5 ); + + lblTradingStatus = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + lblTradingStatus->Wrap( -1 ); + gszrStatus->Add( lblTradingStatus, 0, wxALL, 5 ); + + + vszrContent->Add( gszrStatus, 1, wxEXPAND, 5 ); + + wxStdDialogButtonSizer* szrStandardButtons; + wxButton* szrStandardButtonsOK; + szrStandardButtons = new wxStdDialogButtonSizer(); + szrStandardButtonsOK = new wxButton( this, wxID_OK ); + szrStandardButtons->AddButton( szrStandardButtonsOK ); + szrStandardButtons->Realize(); + + vszrContent->Add( szrStandardButtons, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + + this->SetSizer( vszrContent ); + this->Layout(); + vszrContent->Fit( this ); + + this->Centre( wxBOTH ); +} + +ExchangeStatusDialog::~ExchangeStatusDialog() +{ +} diff --git a/src/wxfb/App.fbp b/src/wxfb/App.fbp new file mode 100644 index 0000000..62d506c --- /dev/null +++ b/src/wxfb/App.fbp @@ -0,0 +1,2428 @@ + + + + + C++ + ; + 0 + connect + none + "kdeck" "wxfb" + + 0 + 1 + res + UTF-8 + App + 6000 + 1 + 1 + UI + App + . + 0 + source_name + 1 + 0 + source_name + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + MainFrame + + 800,600 + wxDEFAULT_FRAME_STYLE + ; ; forward_declare + + + 1 + + + wxTAB_TRAVERSAL + 1 + OnClose + OnShow + + + vszrRoot + wxVERTICAL + none + + 5 + wxEXPAND | wxALL + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + pnlRoot + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxTAB_TRAVERSAL + + + vszrContent + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + + 1 + pnlPortfolio = new kdeck::PortfolioPanel(pnlRoot); + + 1 + kdeck::PortfolioPanel* pnlPortfolio; + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + #include "ui/PortfolioPanel.hpp" + + 0 + + + 0 + + 1 + pnlPortfolio + 1 + + + protected + 1 + + Resizable + + 1 + + ; ; forward_declare + 0 + + + + + + + + + + + + + + 1 + 0 + 1 + + + 0 + wxID_ANY + + + mnuBar + protected + + + + ; ; forward_declare + + + + + + &File + mnuFile + protected + + + 0 + 1 + Login + ID_Login + wxITEM_NORMAL + Login... + mnuLogin + protected + + + OnMenuItemSelected + + + + 0 + 0 + Logout + ID_Logout + wxITEM_NORMAL + Logout... + mnuLogout + protected + + + OnMenuItemSelected + + + mnuSeparatorExit + none + + + + 0 + 1 + + wxID_EXIT + wxITEM_NORMAL + + mnuExit + none + + + OnMenuItemSelected + + + + &Exchange + mnuExchange + protected + + + 0 + 1 + Announcements + ID_Exchange_Announcements + wxITEM_NORMAL + Announcements + mnuItemExchangeAnnouncements + none + + + OnMenuItemSelected + + + + 0 + 1 + Schedule + ID_Exchange_Schedule + wxITEM_NORMAL + Schedule + mnuItemExchangeSchedule + none + + + OnMenuItemSelected + + + + 0 + 1 + Status + ID_Exchange_Status + wxITEM_NORMAL + Status + mnuItemExchangeStatus + none + + + OnMenuItemSelected + + + + &View + mnuView + protected + + + 0 + 0 + Show Closed Positions + ID_View_ShowClosedPositions + wxITEM_CHECK + Show Closed Positions + mnuShowClosedPositions + protected + + + OnMenuItemSelected + + + + &Help + mnuHelp + protected + + + 0 + 1 + + wxID_ABOUT + wxITEM_NORMAL + + mnuAbout + none + + + OnMenuItemSelected + + + + + + + 1 + 0 + 1 + + 3 + + 0 + wxID_ANY + + + statusBar + protected + + + wxSTB_SIZEGRIP + ; ; forward_declare + + + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + LoginDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Login + + 0 + + + + + + vszrContent + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 2 + 0 + + gszrInputs + none + 0 + 0 + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Email + 0 + + 0 + + + 0 + + 1 + lblEmail + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + txtEmail + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Password + 0 + + 0 + + + 0 + + 1 + lblPassword + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + txtPassword + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_PASSWORD + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Remember me + + 0 + + + 0 + + 1 + chkRememberMe + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + szrStandardButtons + none + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + ExchangeAnnouncementsDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Exchange Announcements + + 0 + + + + + + vszrContent + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 4 + wxBOTH + 3 + + 0 + + fgszrAnnouncements + wxFLEX_GROWMODE_SPECIFIED + protected + 1 + 0 + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + There are no announcements. + 0 + + 0 + + + 0 + + 1 + lblNoAnnouncements + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + + szrStandardButtons + none + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + ExchangeScheduleDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Exchange Schedule + + 0 + + + + + + vszrContent + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 2 + 0 + + gszrSchedule + none + 0 + 0 + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Sunday + 0 + + 0 + + + 0 + + 1 + lblSunday + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_LEFT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + lblSundaySchedule + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Monday + 0 + + 0 + + + 0 + + 1 + lblMonday + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + lblMondaySchedule + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Tuesday + 0 + + 0 + + + 0 + + 1 + lblTuesday + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + lblTuesdaySchedule + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Wednesday + 0 + + 0 + + + 0 + + 1 + lblWednesday + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + lblWednesdaySchedule + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Thursday + 0 + + 0 + + + 0 + + 1 + lblThursday + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + lblThursdaySchedule + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Friday + 0 + + 0 + + + 0 + + 1 + lblFriday + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + lblFridaySchedule + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Saturday + 0 + + 0 + + + 0 + + 1 + lblSaturday + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + lblSaturdaySchedule + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Scheduled Maintenance Closures + 0 + + 0 + + + 0 + + 1 + lblScheduledMaintenance + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND + 0 + + 2 + 0 + + gszrMaintenanceScheduleColumns + protected + 0 + 0 + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Start + 0 + + 0 + + + 0 + + 1 + lblStart + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALL|wxLEFT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + End + 0 + + 0 + + + 0 + + 1 + m_staticText118 + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + wxEXPAND + 1 + + 2 + 0 + + gszrMaintenanceSchedule + protected + 0 + 0 + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + There are no scheduled maintenance closures. + 0 + + 0 + + + 0 + + 1 + lblNoScheduledMaintenance + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + + szrStandardButtons + none + + + + + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 0 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + ExchangeStatusDialog + + + wxDEFAULT_DIALOG_STYLE + ; ; forward_declare + Exchange Status + + 0 + + + + + + vszrContent + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + 2 + 0 + + gszrStatus + none + 0 + 0 + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Exchange + 0 + + 0 + + + 0 + + 1 + lblExchange + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + lblExchangeStatus + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Trading + 0 + + 0 + + + 0 + + 1 + lblTrading + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + lblTradingStatus + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + + szrStandardButtons + none + + + + + + diff --git a/src/wxfb/App.h b/src/wxfb/App.h new file mode 100644 index 0000000..c4de319 --- /dev/null +++ b/src/wxfb/App.h @@ -0,0 +1,173 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-33-g6494dcef) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include "ui/PortfolioPanel.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +namespace kdeck +{ + namespace wxfb + { + /////////////////////////////////////////////////////////////////////////////// + /// Class MainFrame + /////////////////////////////////////////////////////////////////////////////// + class MainFrame : public wxFrame + { + private: + + protected: + enum + { + ID_Login = 6000, + ID_Logout, + ID_Exchange_Announcements, + ID_Exchange_Schedule, + ID_Exchange_Status, + ID_View_ShowClosedPositions, + }; + + wxPanel* pnlRoot; + kdeck::PortfolioPanel* pnlPortfolio; + wxMenuBar* mnuBar; + wxMenu* mnuFile; + wxMenuItem* mnuLogin; + wxMenuItem* mnuLogout; + wxMenu* mnuExchange; + wxMenu* mnuView; + wxMenuItem* mnuShowClosedPositions; + wxMenu* mnuHelp; + wxStatusBar* statusBar; + + // Virtual event handlers, override them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnShow( wxShowEvent& event ) { event.Skip(); } + virtual void OnMenuItemSelected( wxCommandEvent& event ) { event.Skip(); } + + + public: + + MainFrame(); + MainFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 800,600 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + bool Create( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 800,600 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); + + ~MainFrame(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class LoginDialog + /////////////////////////////////////////////////////////////////////////////// + class LoginDialog : public wxDialog + { + private: + + protected: + wxTextCtrl* txtEmail; + wxTextCtrl* txtPassword; + wxCheckBox* chkRememberMe; + + public: + + LoginDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Login"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + + ~LoginDialog(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class ExchangeAnnouncementsDialog + /////////////////////////////////////////////////////////////////////////////// + class ExchangeAnnouncementsDialog : public wxDialog + { + private: + + protected: + wxFlexGridSizer* fgszrAnnouncements; + wxStaticText* lblNoAnnouncements; + + public: + + ExchangeAnnouncementsDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Exchange Announcements"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + + ~ExchangeAnnouncementsDialog(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class ExchangeScheduleDialog + /////////////////////////////////////////////////////////////////////////////// + class ExchangeScheduleDialog : public wxDialog + { + private: + + protected: + wxStaticText* lblSundaySchedule; + wxStaticText* lblMondaySchedule; + wxStaticText* lblTuesdaySchedule; + wxStaticText* lblWednesdaySchedule; + wxStaticText* lblThursdaySchedule; + wxStaticText* lblFridaySchedule; + wxStaticText* lblSaturdaySchedule; + wxStaticText* lblScheduledMaintenance; + wxGridSizer* gszrMaintenanceScheduleColumns; + wxGridSizer* gszrMaintenanceSchedule; + wxStaticText* lblNoScheduledMaintenance; + + public: + + ExchangeScheduleDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Exchange Schedule"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + + ~ExchangeScheduleDialog(); + + }; + + /////////////////////////////////////////////////////////////////////////////// + /// Class ExchangeStatusDialog + /////////////////////////////////////////////////////////////////////////////// + class ExchangeStatusDialog : public wxDialog + { + private: + + protected: + wxStaticText* lblExchangeStatus; + wxStaticText* lblTradingStatus; + + public: + + ExchangeStatusDialog( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Exchange Status"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + + ~ExchangeStatusDialog(); + + }; + + } // namespace wxfb +} // namespace kdeck + diff --git a/src/wxfb/CMakeLists.txt b/src/wxfb/CMakeLists.txt new file mode 100644 index 0000000..7b37e29 --- /dev/null +++ b/src/wxfb/CMakeLists.txt @@ -0,0 +1,23 @@ +project(wxfb) + +add_library(${PROJECT_NAME} STATIC + App.cpp + PortfolioPanel.cpp +) + +target_include_directories(${PROJECT_NAME} + PUBLIC + $ + $ + $ +) + +target_link_libraries(${PROJECT_NAME} + PUBLIC + ui + PRIVATE + OpenGL::EGL + wx::core + wx::base + wx::gl +) diff --git a/src/wxfb/PortfolioPanel.cpp b/src/wxfb/PortfolioPanel.cpp new file mode 100644 index 0000000..84bc1ed --- /dev/null +++ b/src/wxfb/PortfolioPanel.cpp @@ -0,0 +1,55 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-33-g6494dcef) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "PortfolioPanel.h" + +/////////////////////////////////////////////////////////////////////////// +using namespace kdeck::wxfb; + +PortfolioPanel::PortfolioPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) +{ + wxBoxSizer* vszrContent; + vszrContent = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* hszrPortfolioInfo; + hszrPortfolioInfo = new wxBoxSizer( wxHORIZONTAL ); + + + hszrPortfolioInfo->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxStaticText* lblBalance; + lblBalance = new wxStaticText( this, wxID_ANY, _("Balance"), wxDefaultPosition, wxDefaultSize, 0 ); + lblBalance->Wrap( -1 ); + hszrPortfolioInfo->Add( lblBalance, 0, wxALL, 5 ); + + lblBalanceAmount = new StaticCurrency(this); + hszrPortfolioInfo->Add( lblBalanceAmount, 0, wxALL, 5 ); + + + vszrContent->Add( hszrPortfolioInfo, 0, wxEXPAND, 5 ); + + pnlPositions = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL ); + pnlPositions->SetScrollRate( 5, 5 ); + fgszrPositions = new wxFlexGridSizer( 0, 6, 10, 10 ); + fgszrPositions->AddGrowableCol( 0 ); + fgszrPositions->SetFlexibleDirection( wxBOTH ); + fgszrPositions->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + + pnlPositions->SetSizer( fgszrPositions ); + pnlPositions->Layout(); + fgszrPositions->Fit( pnlPositions ); + vszrContent->Add( pnlPositions, 1, wxEXPAND | wxALL, 5 ); + + + this->SetSizer( vszrContent ); + this->Layout(); +} + +PortfolioPanel::~PortfolioPanel() +{ +} diff --git a/src/wxfb/PortfolioPanel.fbp b/src/wxfb/PortfolioPanel.fbp new file mode 100644 index 0000000..1bb06dd --- /dev/null +++ b/src/wxfb/PortfolioPanel.fbp @@ -0,0 +1,285 @@ + + + + + C++ + ; + 0 + connect + none + "kdeck" "wxfb" + + 0 + 1 + res + UTF-8 + PortfolioPanel + 6000 + 1 + 1 + UI + PortfolioPanel + . + 0 + source_name + 1 + 0 + source_name + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 0 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PortfolioPanel + + 500,300 + ; ; forward_declare + + 0 + + + wxTAB_TRAVERSAL + + + vszrContent + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + hszrPortfolioInfo + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + 0 + none + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Balance + 0 + + 0 + + + 0 + + 1 + lblBalance + 1 + + + none + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + + 1 + lblBalanceAmount = new StaticCurrency(this); + + 1 + StaticCurrency* lblBalanceAmount; + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + #include "ui/StaticCurrency.hpp" + + 0 + + + 0 + + 1 + lblBalanceAmount + 1 + + + protected + 1 + + Resizable + + 1 + + ; ; forward_declare + 0 + + + + + + + + + + 5 + wxEXPAND | wxALL + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + pnlPositions + 1 + + + protected + 1 + + Resizable + 5 + 5 + 1 + + ; ; forward_declare + 0 + + + + wxHSCROLL|wxVSCROLL + + 6 + wxBOTH + 0 + + 10 + + fgszrPositions + wxFLEX_GROWMODE_SPECIFIED + protected + 0 + 10 + + + + + + + diff --git a/src/wxfb/PortfolioPanel.h b/src/wxfb/PortfolioPanel.h new file mode 100644 index 0000000..24dac96 --- /dev/null +++ b/src/wxfb/PortfolioPanel.h @@ -0,0 +1,52 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 4.2.1-33-g6494dcef) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ui/StaticCurrency.hpp" +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +namespace kdeck +{ + namespace wxfb + { + /////////////////////////////////////////////////////////////////////////////// + /// Class PortfolioPanel + /////////////////////////////////////////////////////////////////////////////// + class PortfolioPanel : public wxPanel + { + private: + + protected: + StaticCurrency* lblBalanceAmount; + wxScrolledWindow* pnlPositions; + wxFlexGridSizer* fgszrPositions; + + public: + + PortfolioPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + ~PortfolioPanel(); + + }; + + } // namespace wxfb +} // namespace kdeck +