bool mmAssetsPanel::Create(wxWindow *parent , wxWindowID winid , const wxPoint &pos , const wxSize &size , long style , const wxString &name) { SetExtraStyle(GetExtraStyle() | wxWS_EX_BLOCK_EVENTS); if (!wxPanel::Create(parent, winid, pos, size, style, name)) return false; this->windowsFreezeThaw(); tips_ = _("MMEX allows you to track fixed assets like cars, houses, land and others. Each asset can have its value appreciate by a certain rate per year, depreciate by a certain rate per year, or not change in value. The total assets are added to your total financial worth."); CreateControls(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); initVirtualListControl(-1, m_listCtrlAssets->m_selected_col, m_listCtrlAssets->m_asc); if (!this->m_assets.empty()) m_listCtrlAssets->EnsureVisible(this->m_assets.size() - 1); this->windowsFreezeThaw(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); return true; }
void mmBudgetingPanel::OnListItemActivated(int selectedIndex) { /*************************************************************************** A TOTALS entry does not contain a budget entry, therefore ignore the event. ***************************************************************************/ if (budget_[selectedIndex].first < 0) return; Model_Budget::Data_Set budget = Model_Budget::instance().find(Model_Budget::BUDGETYEARID(GetBudgetYearID()) , Model_Budget::CATEGID(budget_[selectedIndex].first), Model_Budget::SUBCATEGID(budget_[selectedIndex].second)); Model_Budget::Data* entry = 0; if (budget.empty()) { entry = Model_Budget::instance().create(); entry->BUDGETYEARID = GetBudgetYearID(); entry->CATEGID = budget_[selectedIndex].first; entry->SUBCATEGID = budget_[selectedIndex].second; entry->PERIOD = ""; entry->AMOUNT = 0.0; Model_Budget::instance().save(entry); } else entry = &budget[0]; double estimated = getEstimate(budget_[selectedIndex].first, budget_[selectedIndex].second); double actual = categoryStats_[budget_[selectedIndex].first][budget_[selectedIndex].second][0]; mmBudgetEntryDialog dlg(this, entry, Model_Currency::toCurrency(estimated), Model_Currency::toCurrency(actual)); if (dlg.ShowModal() == wxID_OK) { initVirtualListControl(); listCtrlBudget_->Refresh(); listCtrlBudget_->Update(); listCtrlBudget_->EnsureVisible(selectedIndex); } }
void mmBudgetingPanel::RefreshList() { initVirtualListControl(); listCtrlBudget_->Refresh(); if (!budget_.empty()) listCtrlBudget_->EnsureVisible(0); }
void mmBillsDepositsPanel::OnFilterTransactions(wxMouseEvent& event) { int e = event.GetEventType(); wxBitmap bitmapFilterIcon(rightarrow_xpm); if (e == wxEVT_LEFT_DOWN) { if (transFilterDlg_->ShowModal() == wxID_OK && transFilterDlg_->somethingSelected()) { transFilterActive_ = true; wxBitmap activeBitmapFilterIcon(tipicon_xpm); bitmapFilterIcon = activeBitmapFilterIcon; } else { transFilterActive_ = false; } } else { if (transFilterActive_ == false) return; transFilterActive_ = false; } wxImage pic = bitmapFilterIcon.ConvertToImage(); bitmapTransFilter_->SetBitmap(pic); initVirtualListControl(); }
StocksListCtrl::StocksListCtrl(mmStocksPanel* cp, wxWindow *parent, wxWindowID winid) : mmListCtrl(parent, winid) , stock_panel_(cp) , m_imageList(0) { ColName_[COL_ICON] = (" "); ColName_[COL_ID] = _("ID"); ColName_[COL_DATE] = _("Purchase Date"); ColName_[COL_NAME] = _("Share Name"); ColName_[COL_SYMBOL] = _("Share Symbol"); ColName_[COL_NUMBER] = _("Number of Shares"); ColName_[COL_PRICE] = _("Unit Price"); ColName_[COL_VALUE] = _("Total Value"); ColName_[COL_GAIN_LOSS] = _("Gain/Loss"); ColName_[COL_CURRENT] = _("Curr. unit price"); ColName_[COL_CURRVALUE] = _("Curr. total value"); ColName_[COL_PRICEDATE] = _("Price Date"); ColName_[COL_COMMISSION]= _("Commission"); ColName_[COL_NOTES] = _("Notes"); wxSize imageSize(16, 16); m_imageList = new wxImageList(imageSize.GetWidth(), imageSize.GetHeight()); m_imageList->Add(wxBitmap(wxImage(uparrow_xpm).Scale(16, 16))); m_imageList->Add(wxBitmap(wxImage(downarrow_red_xpm).Scale(16, 16))); m_imageList->Add(wxBitmap(wxImage(uparrow_xpm).Scale(16, 16))); m_imageList->Add(wxBitmap(wxImage(downarrow_xpm).Scale(16, 16))); SetImageList(m_imageList, wxIMAGE_LIST_SMALL); wxListItem itemCol; for (const auto&column : ColName_) { itemCol.SetText(column.second); InsertColumn(column.first, column.second, (column.first == 1 || column.first<4 || column.first>10 || column.first == 12 ? wxLIST_FORMAT_LEFT : wxLIST_FORMAT_RIGHT)); int col_x = Model_Setting::instance().GetIntSetting(wxString::Format("STOCKS_COL%d_WIDTH", column.first), wxLIST_AUTOSIZE_USEHEADER); SetColumnWidth(column.first, col_x); } // load the global variables m_selected_col = Model_Setting::instance().GetIntSetting("STOCKS_SORT_COL", col_sort()); m_asc = Model_Setting::instance().GetBoolSetting("STOCKS_ASC", true); initVirtualListControl(-1, m_selected_col, m_asc); if (!m_stocks.empty()) EnsureVisible(m_stocks.size() - 1); }
bool mmBudgetingPanel::Create(wxWindow *parent , wxWindowID winid, const wxPoint& pos , const wxSize& size, long style, const wxString& name) { SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); wxPanel::Create(parent, winid, pos, size, style, name); this->windowsFreezeThaw(); CreateControls(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); initVirtualListControl(); if (!budget_.empty()) listCtrlBudget_->EnsureVisible(0); this->windowsFreezeThaw(); return TRUE; }
void StocksListCtrl::doRefreshItems(int trx_id) { int selectedIndex = initVirtualListControl(trx_id, m_selected_col, m_asc); long cnt = static_cast<long>(m_stocks.size()); if (selectedIndex >= cnt || selectedIndex < 0) selectedIndex = m_asc ? cnt - 1 : 0; if (cnt>0) { RefreshItems(0, cnt > 0 ? cnt - 1 : 0); } else selectedIndex = -1; if (selectedIndex >= 0 && cnt>0) { SetItemState(selectedIndex, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); SetItemState(selectedIndex, wxLIST_STATE_FOCUSED, wxLIST_STATE_FOCUSED); EnsureVisible(selectedIndex); } }
bool mmBillsDepositsPanel::Create(wxWindow *parent , wxWindowID winid, const wxPoint& pos , const wxSize& size, long style, const wxString& name) { SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); wxPanel::Create(parent, winid, pos, size, style, name); this->windowsFreezeThaw(); CreateControls(); GetSizer()->Fit(this); GetSizer()->SetSizeHints(this); /* Set up the transaction filter. The transFilter dialog will be destroyed when the checking panel is destroyed. */ transFilterActive_ = false; transFilterDlg_ = new mmFilterTransactionsDialog(this); initVirtualListControl(); this->windowsFreezeThaw(); return TRUE; }