Skip to content

Commit

Permalink
Merge pull request #72 from krazkidd/12-wxformbuilder
Browse files Browse the repository at this point in the history
Add wxFormBuilder project
  • Loading branch information
krazkidd authored Aug 11, 2024
2 parents f4b727d + 311dc13 commit 45cf214
Show file tree
Hide file tree
Showing 29 changed files with 3,539 additions and 642 deletions.
1 change: 1 addition & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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].
Expand Down
26 changes: 0 additions & 26 deletions include/ui/BalancePanel.hpp

This file was deleted.

25 changes: 0 additions & 25 deletions include/ui/EventPositionPanel.hpp

This file was deleted.

12 changes: 4 additions & 8 deletions include/ui/ExchangeAnnouncementsDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,18 @@

#include <wx/wx.h>

Check failure on line 4 in include/ui/ExchangeAnnouncementsDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/ExchangeAnnouncementsDialog.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#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();
};
}

Expand Down
20 changes: 4 additions & 16 deletions include/ui/ExchangeScheduleDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,18 @@

#include <wx/wx.h>

Check failure on line 4 in include/ui/ExchangeScheduleDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/ExchangeScheduleDialog.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#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();
};
}

Expand Down
13 changes: 4 additions & 9 deletions include/ui/ExchangeStatusDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@

#include <wx/wx.h>

Check failure on line 4 in include/ui/ExchangeStatusDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/ExchangeStatusDialog.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#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();
};
}

Expand Down
14 changes: 4 additions & 10 deletions include/ui/LoginDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,23 @@

#include <wx/wx.h>

Check failure on line 4 in include/ui/LoginDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/LoginDialog.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#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);

std::string GetEmail() const;

Check warning on line 19 in include/ui/LoginDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/LoginDialog.hpp:19:21 [modernize-use-trailing-return-type]

use a trailing return type for this function
std::string GetPassword() const;

Check warning on line 20 in include/ui/LoginDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/LoginDialog.hpp:20:21 [modernize-use-trailing-return-type]

use a trailing return type for this function

bool GetRememberMe() const;

Check warning on line 22 in include/ui/LoginDialog.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/LoginDialog.hpp:22:14 [modernize-use-trailing-return-type]

use a trailing return type for this function

private:
wxTextCtrl* txtEmail;
wxTextCtrl* txtPassword;
wxCheckBox* chkRememberMe;

// init
void Setup();
};
}

Expand Down
28 changes: 7 additions & 21 deletions include/ui/MainFrame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,15 @@

#include <wx/wx.h>

Check failure on line 4 in include/ui/MainFrame.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/MainFrame.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#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});
Expand All @@ -33,11 +23,7 @@ namespace kdeck
Config config;
Api api;

wxMenuItem *mnuLogin;
wxMenuItem *mnuLogout;
wxMenuItem *mnuShowClosedPositions;

PortfolioPanel* pnlPortfolio;
bool isLoginDialogShownOnce = false;

// init
void Setup();
Expand All @@ -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;
};
}

Expand Down
25 changes: 0 additions & 25 deletions include/ui/MarketPositionPanel.hpp

This file was deleted.

12 changes: 3 additions & 9 deletions include/ui/PortfolioPanel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,19 @@

#include <wx/wx.h>

Check failure on line 4 in include/ui/PortfolioPanel.hpp

View workflow job for this annotation

GitHub Actions / cpp-linter

include/ui/PortfolioPanel.hpp:4:10 [clang-diagnostic-error]

'wx/wx.h' file not found

#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();
};
}

Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ target_link_libraries(${PROJECT_NAME}
add_subdirectory(api)
add_subdirectory(config)
add_subdirectory(ui)
add_subdirectory(wxfb)
59 changes: 0 additions & 59 deletions src/ui/BalancePanel.cpp

This file was deleted.

Loading

0 comments on commit 45cf214

Please sign in to comment.