CRateLimiter::CRateLimiter(fz::event_loop& loop, COptionsBase& options) : event_handler(loop) , options_(options) { RegisterOption(OPTION_SPEEDLIMIT_ENABLE); RegisterOption(OPTION_SPEEDLIMIT_INBOUND); RegisterOption(OPTION_SPEEDLIMIT_OUTBOUND); m_tokenDebt[0] = 0; m_tokenDebt[1] = 0; }
void ProgramOptions::RegisterOption(const CString& cszShortOptionChars, const CString& cszLongOption, const CString& cszHelpText, bool& bOptionFlag) { T_fnOptionHandlerSingleArg fnOptionHandler = std::bind(&ProgramOptions::SetBoolArgStorage, std::ref(bOptionFlag)); RegisterOption(cszShortOptionChars, cszLongOption, cszHelpText, fnOptionHandler); }
void ProgramOptions::RegisterOption(const CString& cszShortOptionChars, const CString& cszLongOption, const CString& cszHelpText, CString& cszArgStorage) { T_fnOptionHandlerSingleArg fnOptionHandler = std::bind(&ProgramOptions::SetStringArgStorage, std::placeholders::_1, std::ref(cszArgStorage)); RegisterOption(cszShortOptionChars, cszLongOption, cszHelpText, fnOptionHandler); }
void ProgramOptions::RegisterOption(const CString& cszShortOptionChars, const CString& cszLongOption, const CString& cszHelpText, T_fnOptionHandlerNoArg fnOptionHandler) { T_fnOptionHandler fnOptionHandler2 = std::bind([&]() -> bool { return fnOptionHandler(); }); RegisterOption(cszShortOptionChars, cszLongOption, cszHelpText, 0, fnOptionHandler2); }
CRemoteTreeView::CRemoteTreeView(wxWindow* parent, wxWindowID id, CState* pState, CQueueView* pQueue) : wxTreeCtrlEx(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTR_EDIT_LABELS | wxTR_LINES_AT_ROOT | wxTR_HAS_BUTTONS | wxNO_BORDER | wxTR_HIDE_ROOT), CSystemImageList(16), CStateEventHandler(pState) { #ifdef __WXMAC__ SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); #endif pState->RegisterHandler(this, STATECHANGE_REMOTE_DIR); pState->RegisterHandler(this, STATECHANGE_APPLYFILTER); CreateImageList(); UpdateSortMode(); RegisterOption(OPTION_FILELIST_NAMESORT); m_busy = false; m_pQueue = pQueue; AddRoot(_T("")); m_ExpandAfterList = wxTreeItemId(); SetDropTarget(new CRemoteTreeViewDropTarget(this)); Enable(false); }
CLocalTreeView::CLocalTreeView(wxWindow* parent, wxWindowID id, CState *pState, CQueueView *pQueueView) : wxTreeCtrlEx(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxTR_EDIT_LABELS | wxTR_LINES_AT_ROOT | wxTR_HAS_BUTTONS | wxNO_BORDER), CSystemImageList(16), CStateEventHandler(pState), m_pQueueView(pQueueView) { wxGetApp().AddStartupProfileRecord(_T("CLocalTreeView::CLocalTreeView")); #ifdef __WXMAC__ SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); #endif pState->RegisterHandler(this, STATECHANGE_LOCAL_DIR); pState->RegisterHandler(this, STATECHANGE_APPLYFILTER); SetImageList(GetSystemImageList()); UpdateSortMode(); RegisterOption(OPTION_FILELIST_NAMESORT); #ifdef __WXMSW__ m_pVolumeEnumeratorThread = 0; CreateRoot(); #else wxTreeItemId root = AddRoot(_T("/")); SetItemImage(root, GetIconIndex(iconType::dir), wxTreeItemIcon_Normal); SetItemImage(root, GetIconIndex(iconType::opened_dir), wxTreeItemIcon_Selected); SetItemImage(root, GetIconIndex(iconType::dir), wxTreeItemIcon_Expanded); SetItemImage(root, GetIconIndex(iconType::opened_dir), wxTreeItemIcon_SelectedExpanded); SetDir(_T("/")); #endif SetDropTarget(new CLocalTreeViewDropTarget(this)); }
void ProgramOptions::RegisterOption(const CString& cszShortOptionChars, const CString& cszLongOption, const CString& cszHelpText, T_fnOptionHandlerSingleArg fnOptionHandler) { T_fnOptionHandler fnOptionHandler2 = std::bind(&ProgramOptions::CallSingleArgHandler, std::placeholders::_1, fnOptionHandler); RegisterOption(cszShortOptionChars, cszLongOption, cszHelpText, 1, fnOptionHandler2); }
CThemeProvider::CThemeProvider() { wxArtProvider::Push(this); m_themePath = GetThemePath(); RegisterOption(OPTION_THEME); }
/// ctor ConsoleServerProgramOptions() :m_usPort(c_usDefaultServerPort) { RegisterOutputHandler(&ProgramOptions::OutputConsole); RegisterHelpOption(); CString cszDescription; cszDescription.Format(_T("Port for game clients (default: %u)"), c_usDefaultServerPort); ProgramOptions::T_fnOptionHandlerSingleArg fn = std::bind(&ConsoleServerProgramOptions::ParsePort, this, std::placeholders::_1); RegisterOption(_T("p"), _T("port"), cszDescription, fn); }
void ProgramOptions::RegisterHelpOption() { T_fnOptionHandler fnOptionHandler = std::bind(&ProgramOptions::OutputHelp, this); RegisterOption(_T("h?"), _T("help"), _T("Shows help"), 0, fnOptionHandler); }