diff options
Diffstat (limited to 'wx+')
-rw-r--r-- | wx+/grid.cpp | 8 | ||||
-rw-r--r-- | wx+/grid.h | 4 | ||||
-rw-r--r-- | wx+/http.cpp | 85 | ||||
-rw-r--r-- | wx+/http.h | 4 | ||||
-rw-r--r-- | wx+/image_resources.cpp | 32 | ||||
-rw-r--r-- | wx+/popup_dlg.cpp | 26 | ||||
-rw-r--r-- | wx+/popup_dlg.h | 6 | ||||
-rw-r--r-- | wx+/popup_dlg_generated.cpp | 152 | ||||
-rw-r--r-- | wx+/popup_dlg_generated.h | 56 |
9 files changed, 195 insertions, 178 deletions
diff --git a/wx+/grid.cpp b/wx+/grid.cpp index 94bcadd9..13c06704 100644 --- a/wx+/grid.cpp +++ b/wx+/grid.cpp @@ -188,7 +188,7 @@ wxSize GridData::drawCellText(wxDC& dc, const wxRect& rect, const std::wstring& RecursiveDcClipper clip(dc, rect); dc.DrawText(textTrunc, pt); - return extentTrunc; + return extentTrunc; } @@ -1151,9 +1151,9 @@ private: void evalMousePos() { - const auto now = std::chrono::steady_clock::now(); - const double deltaSecs = std::chrono::duration<double>(now - lastEvalTime).count(); //unit: [sec] - lastEvalTime = now; + const auto now = std::chrono::steady_clock::now(); + const double deltaSecs = std::chrono::duration<double>(now - lastEvalTime).count(); //unit: [sec] + lastEvalTime = now; const wxPoint clientPos = wnd_.ScreenToClient(wxGetMousePosition()); const wxSize clientSize = wnd_.GetClientSize(); @@ -215,8 +215,8 @@ public: //############################################################################################################ -static wxColor getColorSelectionGradientFrom(); -static wxColor getColorSelectionGradientTo(); + static wxColor getColorSelectionGradientFrom(); + static wxColor getColorSelectionGradientTo(); private: void onPaintEvent(wxPaintEvent& event); diff --git a/wx+/http.cpp b/wx+/http.cpp index af51090c..ce3de482 100644 --- a/wx+/http.cpp +++ b/wx+/http.cpp @@ -6,11 +6,12 @@ #include "http.h" #ifdef ZEN_WIN - #include <zen/win.h> //tame wininet.h include - #include <wininet.h> + #include <zen/win.h> //tame WinINet.h include + #include <WinINet.h> #endif #if defined ZEN_LINUX || defined ZEN_MAC + #include <wx/app.h> #include <zen/thread.h> //std::thread::id #include <wx/protocol/http.h> #endif @@ -31,7 +32,7 @@ namespace #endif -std::string sendHttpRequestImpl(const std::wstring& url, //throw FileError +std::string sendHttpRequestImpl(const std::wstring& url, //throw SysError const std::wstring& userAgent, const std::string* postParams, //issue POST if bound, GET otherwise int level = 0) @@ -49,7 +50,7 @@ std::string sendHttpRequestImpl(const std::wstring& url, //throw FileError nullptr, //_In_ LPCTSTR lpszProxyBypass, 0); //_In_ DWORD dwFlags if (!hInternet) - THROW_LAST_FILE_ERROR(_("Internet access failed."), L"InternetOpen"); + THROW_LAST_SYS_ERROR(L"InternetOpen"); ZEN_ON_SCOPE_EXIT(::InternetCloseHandle(hInternet)); HINTERNET hSession = ::InternetConnect(hInternet, //_In_ HINTERNET hInternet, @@ -61,16 +62,28 @@ std::string sendHttpRequestImpl(const std::wstring& url, //throw FileError 0, //_In_ DWORD dwFlags, 0); //_In_ DWORD_PTR dwContext if (!hSession) - THROW_LAST_FILE_ERROR(_("Internet access failed."), L"InternetConnect"); + THROW_LAST_SYS_ERROR(L"InternetConnect"); ZEN_ON_SCOPE_EXIT(::InternetCloseHandle(hSession)); const wchar_t* acceptTypes[] = { L"*/*", nullptr }; - DWORD requestFlags = INTERNET_FLAG_KEEP_CONNECTION | - INTERNET_FLAG_NO_UI | - INTERNET_FLAG_RELOAD | // - INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS; //relevant for GET only + DWORD requestFlags = + //INTERNET_FLAG_KEEP_CONNECTION | + // the combination 1. INTERNET_FLAG_KEEP_CONNECTION (= adds "Connection: Keep-Alive" but NOT "Keep-Alive: timeout" to the header) + // 2. *no* "Keep-Alive: timeout" header entry 3. call from within VM and 4. *no* Fiddler running 5. HTTP POST + // leads to Godaddy blocking the IP: http://www.freefilesync.org/forum/viewtopic.php?t=3855 + // => it seems a broken keep alive header is the trigger: But why is it then working outside the VM or when Fiddler is running??? Why not a problem for HTTP GET? + // note: HTTP/1.1 has keep-alive semantics by default, so this flag is probably useless anyway + INTERNET_FLAG_NO_UI; + if (postParams) - requestFlags |= INTERNET_FLAG_NO_AUTO_REDIRECT; //POST would be re-issued as GET during auto-redirect => handle ourselves! + { + requestFlags |= INTERNET_FLAG_NO_AUTO_REDIRECT; //POST would be re-issued as GET during auto-redirect => handle ourselves! + } + else //HTTP GET + { + requestFlags |= INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTPS | INTERNET_FLAG_IGNORE_REDIRECT_TO_HTTP; + requestFlags |= INTERNET_FLAG_RELOAD; //not relevant for POST (= never cached) + } HINTERNET hRequest = ::HttpOpenRequest(hSession, //_In_ HINTERNET hConnect, postParams ? L"POST" : L"GET", //_In_ LPCTSTR lpszVerb, @@ -81,18 +94,22 @@ std::string sendHttpRequestImpl(const std::wstring& url, //throw FileError requestFlags, //_In_ DWORD dwFlags, 0); //_In_ DWORD_PTR dwContext if (!hRequest) - THROW_LAST_FILE_ERROR(_("Internet access failed."), L"HttpOpenRequest"); + THROW_LAST_SYS_ERROR(L"HttpOpenRequest"); ZEN_ON_SCOPE_EXIT(::InternetCloseHandle(hRequest)); - const std::wstring headers = postParams ? L"Content-type: application/x-www-form-urlencoded" : L""; - std::string postParamsTmp = postParams ? *postParams : ""; - char* postParamBuf = postParamsTmp.empty() ? nullptr : &*postParamsTmp.begin(); + const std::wstring headers = postParams ? L"Content-type: application/x-www-form-urlencoded" : L""; + + assert(std::all_of(headers.begin(), headers.end(), [](wchar_t c){ return makeUnsigned(c) < 128; })); + //HttpSendRequest has finicky behavior for non-ASCII headers: https://msdn.microsoft.com/en-us/library/windows/desktop/aa384247 + + std::string postParamsBuf = postParams ? *postParams : ""; + if (!::HttpSendRequest(hRequest, //_In_ HINTERNET hRequest, headers.c_str(), //_In_ LPCTSTR lpszHeaders, - static_cast<DWORD>(headers.size()), //_In_ DWORD dwHeadersLength, - postParamBuf, //_In_ LPVOID lpOptional, - static_cast<DWORD>(postParamsTmp.size()))) //_In_ DWORD dwOptionalLength - THROW_LAST_FILE_ERROR(_("Internet access failed."), L"HttpSendRequest"); + static_cast<DWORD>(headers.size()), //_In_ DWORD dwHeadersLength, + postParamsBuf.empty() ? nullptr : &postParamsBuf[0], //_In_ LPVOID lpOptional, + static_cast<DWORD>(postParamsBuf.size()))) //_In_ DWORD dwOptionalLength + THROW_LAST_SYS_ERROR(L"HttpSendRequest"); DWORD sc = 0; { @@ -102,7 +119,7 @@ std::string sendHttpRequestImpl(const std::wstring& url, //throw FileError &sc, //_Inout_ LPVOID lpvBuffer, &bufLen, //_Inout_ LPDWORD lpdwBufferLength, nullptr)) //_Inout_ LPDWORD lpdwIndex - THROW_LAST_FILE_ERROR(_("Internet access failed."), L"HttpQueryInfo: HTTP_QUERY_STATUS_CODE"); + THROW_LAST_SYS_ERROR(L"HttpQueryInfo: HTTP_QUERY_STATUS_CODE"); } //http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection @@ -113,19 +130,19 @@ std::string sendHttpRequestImpl(const std::wstring& url, //throw FileError DWORD bufLen = 10000; std::wstring location(bufLen, L'\0'); if (!::HttpQueryInfo(hRequest, HTTP_QUERY_LOCATION, &*location.begin(), &bufLen, nullptr)) - THROW_LAST_FILE_ERROR(_("Internet access failed."), L"HttpQueryInfo: HTTP_QUERY_LOCATION"); + THROW_LAST_SYS_ERROR(L"HttpQueryInfo: HTTP_QUERY_LOCATION"); if (bufLen >= location.size()) //HttpQueryInfo expected to write terminating zero - throw FileError(_("Internet access failed."), L"HttpQueryInfo: HTTP_QUERY_LOCATION, buffer overflow"); + throw SysError(L"HttpQueryInfo: HTTP_QUERY_LOCATION, buffer overflow"); location.resize(bufLen); if (!location.empty()) return sendHttpRequestImpl(location, userAgent, postParams, level + 1); } - throw FileError(_("Internet access failed."), L"Unresolvable redirect."); + throw SysError(L"Unresolvable redirect."); } if (sc != HTTP_STATUS_OK) //200 - throw FileError(_("Internet access failed."), replaceCpy<std::wstring>(L"HTTP status code %x.", L"%x", numberTo<std::wstring>(sc))); + throw SysError(replaceCpy<std::wstring>(L"HTTP status code %x.", L"%x", numberTo<std::wstring>(sc))); //e.g. 404 - HTTP_STATUS_NOT_FOUND std::string buffer; @@ -140,10 +157,10 @@ std::string sendHttpRequestImpl(const std::wstring& url, //throw FileError &*(buffer.begin() + buffer.size() - blockSize), //_Out_ LPVOID lpBuffer, blockSize, //_In_ DWORD dwNumberOfBytesToRead, &bytesRead)) //_Out_ LPDWORD lpdwNumberOfBytesRead - THROW_LAST_FILE_ERROR(_("Internet access failed."), L"InternetReadFile"); + THROW_LAST_SYS_ERROR(L"InternetReadFile"); if (bytesRead > blockSize) //better safe than sorry - throw FileError(_("Internet access failed."), L"InternetReadFile: buffer overflow."); + throw SysError(L"InternetReadFile: buffer overflow."); if (bytesRead < blockSize) buffer.resize(buffer.size() - (blockSize - bytesRead)); //caveat: unsigned arithmetics @@ -161,11 +178,11 @@ std::string sendHttpRequestImpl(const std::wstring& url, //throw FileError webAccess.SetTimeout(10 /*[s]*/); //default: 10 minutes: WTF are these wxWidgets people thinking??? if (!webAccess.Connect(server)) //will *not* fail for non-reachable url here! - throw FileError(_("Internet access failed."), L"wxHTTP::Connect"); + throw SysError(L"wxHTTP::Connect"); if (postParams) if (!webAccess.SetPostText(L"application/x-www-form-urlencoded", utfCvrtTo<wxString>(*postParams))) - throw FileError(_("Internet access failed."), L"wxHTTP::SetPostText"); + throw SysError(L"wxHTTP::SetPostText"); std::unique_ptr<wxInputStream> httpStream(webAccess.GetInputStream(page)); //must be deleted BEFORE webAccess is closed const int sc = webAccess.GetResponse(); @@ -179,14 +196,14 @@ std::string sendHttpRequestImpl(const std::wstring& url, //throw FileError if (!newUrl.empty()) return sendHttpRequestImpl(newUrl, userAgent, postParams, level + 1); } - throw FileError(_("Internet access failed."), L"Unresolvable redirect."); + throw SysError(L"Unresolvable redirect."); } if (sc != 200) //HTTP_STATUS_OK - throw FileError(_("Internet access failed."), replaceCpy<std::wstring>(L"HTTP status code %x.", L"%x", numberTo<std::wstring>(sc))); + throw SysError(replaceCpy<std::wstring>(L"HTTP status code %x.", L"%x", numberTo<std::wstring>(sc))); if (!httpStream || webAccess.GetError() != wxPROTO_NOERR) - throw FileError(_("Internet access failed."), L"wxHTTP::GetError"); + throw SysError(L"wxHTTP::GetError"); std::string buffer; int newValue = 0; @@ -221,7 +238,7 @@ std::string urlencode(const std::string& str) } -std::string zen::sendHttpPost(const std::wstring& url, const std::wstring& userAgent, const std::vector<std::pair<std::string, std::string>>& postParams) //throw FileError +std::string zen::sendHttpPost(const std::wstring& url, const std::wstring& userAgent, const std::vector<std::pair<std::string, std::string>>& postParams) //throw SysError { //convert post parameters into "application/x-www-form-urlencoded" std::string flatParams; @@ -231,13 +248,13 @@ std::string zen::sendHttpPost(const std::wstring& url, const std::wstring& userA if (!flatParams.empty()) flatParams.pop_back(); - return sendHttpRequestImpl(url, userAgent, &flatParams); //throw FileError + return sendHttpRequestImpl(url, userAgent, &flatParams); //throw SysError } -std::string zen::sendHttpGet(const std::wstring& url, const std::wstring& userAgent) //throw FileError +std::string zen::sendHttpGet(const std::wstring& url, const std::wstring& userAgent) //throw SysError { - return sendHttpRequestImpl(url, userAgent, nullptr); //throw FileError + return sendHttpRequestImpl(url, userAgent, nullptr); //throw SysError } @@ -17,8 +17,8 @@ namespace zen Windows: WinInet-based => may be called from worker thread Linux: wxWidgets-based => don't call from worker thread */ -std::string sendHttpPost(const std::wstring& url, const std::wstring& userAgent, const std::vector<std::pair<std::string, std::string>>& postParams); //throw FileError -std::string sendHttpGet (const std::wstring& url, const std::wstring& userAgent); //throw FileError +std::string sendHttpPost(const std::wstring& url, const std::wstring& userAgent, const std::vector<std::pair<std::string, std::string>>& postParams); //throw SysError +std::string sendHttpGet (const std::wstring& url, const std::wstring& userAgent); //throw SysError bool internetIsAlive(); //noexcept } diff --git a/wx+/image_resources.cpp b/wx+/image_resources.cpp index 110539e7..3eb91ee4 100644 --- a/wx+/image_resources.cpp +++ b/wx+/image_resources.cpp @@ -49,7 +49,7 @@ public: static std::shared_ptr<GlobalBitmaps> instance() { static Global<GlobalBitmaps> inst(std::make_unique<GlobalBitmaps>()); - assert(std::this_thread::get_id() == mainThreadId); //wxWidgets is not thread-safe! + assert(std::this_thread::get_id() == mainThreadId); //wxWidgets is not thread-safe! return inst.get(); } @@ -137,35 +137,35 @@ const wxAnimation& GlobalBitmaps::getAnimation(const wxString& name) const void zen::initResourceImages(const Zstring& filepath) { - if (std::shared_ptr<GlobalBitmaps> inst = GlobalBitmaps::instance()) - inst->init(filepath); - else - assert(false); + if (std::shared_ptr<GlobalBitmaps> inst = GlobalBitmaps::instance()) + inst->init(filepath); + else + assert(false); } -void zen::cleanupResourceImages() +void zen::cleanupResourceImages() { - if (std::shared_ptr<GlobalBitmaps> inst = GlobalBitmaps::instance()) - inst->cleanup(); - else - assert(false); + if (std::shared_ptr<GlobalBitmaps> inst = GlobalBitmaps::instance()) + inst->cleanup(); + else + assert(false); } -const wxBitmap& zen::getResourceImage(const wxString& name) +const wxBitmap& zen::getResourceImage(const wxString& name) { - if (std::shared_ptr<GlobalBitmaps> inst = GlobalBitmaps::instance()) - return inst->getImage(name); + if (std::shared_ptr<GlobalBitmaps> inst = GlobalBitmaps::instance()) + return inst->getImage(name); assert(false); return wxNullBitmap; } -const wxAnimation& zen::getResourceAnimation(const wxString& name) +const wxAnimation& zen::getResourceAnimation(const wxString& name) { - if (std::shared_ptr<GlobalBitmaps> inst = GlobalBitmaps::instance()) - return inst->getAnimation(name); + if (std::shared_ptr<GlobalBitmaps> inst = GlobalBitmaps::instance()) + return inst->getAnimation(name); assert(false); return wxNullAnimation; } diff --git a/wx+/popup_dlg.cpp b/wx+/popup_dlg.cpp index 189343e9..918f44a5 100644 --- a/wx+/popup_dlg.cpp +++ b/wx+/popup_dlg.cpp @@ -105,8 +105,8 @@ public: m_bitmapMsgType->SetBitmap(getResourceImage(L"msg_error")); break; } - if (cfg.icon.IsOk()) - m_bitmapMsgType->SetBitmap(cfg.icon); + if (cfg.icon.IsOk()) + m_bitmapMsgType->SetBitmap(cfg.icon); if (titleTmp.empty()) SetTitle(wxTheApp->GetAppDisplayName()); @@ -118,15 +118,15 @@ public: SetTitle(wxTheApp->GetAppDisplayName() + L" - " + titleTmp); } - int maxWidth = 500; - int maxHeight = 400; //try to determine better value based on actual display resolution: + int maxWidth = 500; + int maxHeight = 400; //try to determine better value based on actual display resolution: - if (parent) - { - const int disPos = wxDisplay::GetFromWindow(parent); //window must be visible - if (disPos != wxNOT_FOUND) - maxHeight = wxDisplay(disPos).GetClientArea().GetHeight() * 2 / 3; - } + if (parent) + { + const int disPos = wxDisplay::GetFromWindow(parent); //window must be visible + if (disPos != wxNOT_FOUND) + maxHeight = wxDisplay(disPos).GetClientArea().GetHeight() * 2 / 3; + } assert(!cfg.textMain.empty() || !cfg.textDetail.empty()); if (!cfg.textMain.empty()) @@ -216,7 +216,7 @@ public: setStandardButtonLayout(*bSizerStdButtons, StdButtons().setAffirmative(m_buttonAffirmative)); setAsStandard(*m_buttonAffirmative); GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize() - Center(); //needs to be re-applied after a dialog size change! + Center(); //needs to be re-applied after a dialog size change! } }; @@ -235,7 +235,7 @@ public: setStandardButtonLayout(*bSizerStdButtons, StdButtons().setAffirmative(m_buttonAffirmative).setCancel(m_buttonCancel)); setAsStandard(*m_buttonAffirmative); GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize() - Center(); //needs to be re-applied after a dialog size change! + Center(); //needs to be re-applied after a dialog size change! } }; } @@ -261,7 +261,7 @@ public: setStandardButtonLayout(*bSizerStdButtons, StdButtons().setAffirmative(m_buttonAffirmative).setNegative(m_buttonNegative).setCancel(m_buttonCancel)); setAsStandard(*m_buttonAffirmative); GetSizer()->SetSizeHints(this); //~=Fit() + SetMinSize() - Center(); //needs to be re-applied after a dialog size change! + Center(); //needs to be re-applied after a dialog size change! } private: diff --git a/wx+/popup_dlg.h b/wx+/popup_dlg.h index 7c5db159..892c7a83 100644 --- a/wx+/popup_dlg.h +++ b/wx+/popup_dlg.h @@ -8,7 +8,7 @@ #define POPUP_DLG_H_820780154723456 #ifdef ZEN_WIN -#include <zen/win.h> //include before <wx/msw/wrapwin.h> + #include <zen/win.h> //include before <wx/msw/wrapwin.h> #endif #include <wx/window.h> #include <wx/bitmap.h> @@ -53,7 +53,7 @@ class ConfirmationDialog3; struct PopupDialogCfg { - PopupDialogCfg& setIcon (const wxBitmap& bmp ) { icon = bmp; return *this; } + PopupDialogCfg& setIcon (const wxBitmap& bmp ) { icon = bmp; return *this; } PopupDialogCfg& setTitle (const wxString& label) { title = label; return *this; } PopupDialogCfg& setMainInstructions (const wxString& label) { textMain = label; return *this; } //set at least one of these! PopupDialogCfg& setDetailInstructions(const wxString& label) { textDetail = label; return *this; } // @@ -62,7 +62,7 @@ struct PopupDialogCfg private: friend class StandardPopupDialog; - wxBitmap icon; + wxBitmap icon; wxString title; wxString textMain; wxString textDetail; diff --git a/wx+/popup_dlg_generated.cpp b/wx+/popup_dlg_generated.cpp index 6b20c568..b726aa9a 100644 --- a/wx+/popup_dlg_generated.cpp +++ b/wx+/popup_dlg_generated.cpp @@ -11,82 +11,82 @@ PopupDialogGenerated::PopupDialogGenerated( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); - this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); - - wxBoxSizer* bSizer24; - bSizer24 = new wxBoxSizer( wxVERTICAL ); - - m_panel33 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_panel33->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - - wxBoxSizer* bSizer165; - bSizer165 = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapMsgType = new wxStaticBitmap( m_panel33, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizer165->Add( m_bitmapMsgType, 0, wxALL, 10 ); - - wxBoxSizer* bSizer16; - bSizer16 = new wxBoxSizer( wxVERTICAL ); - - - bSizer16->Add( 0, 10, 0, 0, 5 ); - - m_staticTextMain = new wxStaticText( m_panel33, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextMain->Wrap( -1 ); - bSizer16->Add( m_staticTextMain, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); - - m_textCtrlTextDetail = new wxTextCtrl( m_panel33, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxNO_BORDER ); - bSizer16->Add( m_textCtrlTextDetail, 1, wxEXPAND, 5 ); - - - bSizer165->Add( bSizer16, 1, wxEXPAND, 5 ); - - - m_panel33->SetSizer( bSizer165 ); - m_panel33->Layout(); - bSizer165->Fit( m_panel33 ); - bSizer24->Add( m_panel33, 1, wxEXPAND, 5 ); - - m_staticline6 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bSizer24->Add( m_staticline6, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer25; - bSizer25 = new wxBoxSizer( wxVERTICAL ); - - m_checkBoxCustom = new wxCheckBox( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer25->Add( m_checkBoxCustom, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); - - bSizerStdButtons = new wxBoxSizer( wxHORIZONTAL ); - - m_buttonAffirmative = new wxButton( this, wxID_YES, _("dummy"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizerStdButtons->Add( m_buttonAffirmative, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_buttonNegative = new wxButton( this, wxID_NO, _("dummy"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizerStdButtons->Add( m_buttonNegative, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); - - m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); - bSizerStdButtons->Add( m_buttonCancel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); - - - bSizer25->Add( bSizerStdButtons, 0, wxALIGN_RIGHT, 5 ); - - - bSizer24->Add( bSizer25, 0, wxEXPAND, 5 ); - - - this->SetSizer( bSizer24 ); - this->Layout(); - bSizer24->Fit( this ); - - this->Centre( wxBOTH ); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PopupDialogGenerated::OnClose ) ); - m_checkBoxCustom->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PopupDialogGenerated::OnCheckBoxClick ), NULL, this ); - m_buttonAffirmative->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PopupDialogGenerated::OnButtonAffirmative ), NULL, this ); - m_buttonNegative->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PopupDialogGenerated::OnButtonNegative ), NULL, this ); - m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PopupDialogGenerated::OnCancel ), NULL, this ); + this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); + this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); + + wxBoxSizer* bSizer24; + bSizer24 = new wxBoxSizer( wxVERTICAL ); + + m_panel33 = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_panel33->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + + wxBoxSizer* bSizer165; + bSizer165 = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapMsgType = new wxStaticBitmap( m_panel33, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), 0 ); + bSizer165->Add( m_bitmapMsgType, 0, wxALL, 10 ); + + wxBoxSizer* bSizer16; + bSizer16 = new wxBoxSizer( wxVERTICAL ); + + + bSizer16->Add( 0, 10, 0, 0, 5 ); + + m_staticTextMain = new wxStaticText( m_panel33, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextMain->Wrap( -1 ); + bSizer16->Add( m_staticTextMain, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + m_textCtrlTextDetail = new wxTextCtrl( m_panel33, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxNO_BORDER ); + bSizer16->Add( m_textCtrlTextDetail, 1, wxEXPAND, 5 ); + + + bSizer165->Add( bSizer16, 1, wxEXPAND, 5 ); + + + m_panel33->SetSizer( bSizer165 ); + m_panel33->Layout(); + bSizer165->Fit( m_panel33 ); + bSizer24->Add( m_panel33, 1, wxEXPAND, 5 ); + + m_staticline6 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer24->Add( m_staticline6, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer25; + bSizer25 = new wxBoxSizer( wxVERTICAL ); + + m_checkBoxCustom = new wxCheckBox( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer25->Add( m_checkBoxCustom, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); + + bSizerStdButtons = new wxBoxSizer( wxHORIZONTAL ); + + m_buttonAffirmative = new wxButton( this, wxID_YES, _("dummy"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + bSizerStdButtons->Add( m_buttonAffirmative, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_buttonNegative = new wxButton( this, wxID_NO, _("dummy"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + bSizerStdButtons->Add( m_buttonNegative, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); + + m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize( -1,-1 ), 0 ); + bSizerStdButtons->Add( m_buttonCancel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); + + + bSizer25->Add( bSizerStdButtons, 0, wxALIGN_RIGHT, 5 ); + + + bSizer24->Add( bSizer25, 0, wxEXPAND, 5 ); + + + this->SetSizer( bSizer24 ); + this->Layout(); + bSizer24->Fit( this ); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( PopupDialogGenerated::OnClose ) ); + m_checkBoxCustom->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PopupDialogGenerated::OnCheckBoxClick ), NULL, this ); + m_buttonAffirmative->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PopupDialogGenerated::OnButtonAffirmative ), NULL, this ); + m_buttonNegative->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PopupDialogGenerated::OnButtonNegative ), NULL, this ); + m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PopupDialogGenerated::OnCancel ), NULL, this ); } PopupDialogGenerated::~PopupDialogGenerated() diff --git a/wx+/popup_dlg_generated.h b/wx+/popup_dlg_generated.h index 51a045ad..bef871c7 100644 --- a/wx+/popup_dlg_generated.h +++ b/wx+/popup_dlg_generated.h @@ -37,35 +37,35 @@ /////////////////////////////////////////////////////////////////////////////// /// Class PopupDialogGenerated /////////////////////////////////////////////////////////////////////////////// -class PopupDialogGenerated : public wxDialog +class PopupDialogGenerated : public wxDialog { - private: - - protected: - wxPanel* m_panel33; - wxStaticBitmap* m_bitmapMsgType; - wxStaticText* m_staticTextMain; - wxTextCtrl* m_textCtrlTextDetail; - wxStaticLine* m_staticline6; - wxCheckBox* m_checkBoxCustom; - wxBoxSizer* bSizerStdButtons; - wxButton* m_buttonAffirmative; - wxButton* m_buttonNegative; - wxButton* m_buttonCancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnCheckBoxClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnButtonAffirmative( wxCommandEvent& event ) { event.Skip(); } - virtual void OnButtonNegative( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } - - - public: - - PopupDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("dummy"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~PopupDialogGenerated(); - +private: + +protected: + wxPanel* m_panel33; + wxStaticBitmap* m_bitmapMsgType; + wxStaticText* m_staticTextMain; + wxTextCtrl* m_textCtrlTextDetail; + wxStaticLine* m_staticline6; + wxCheckBox* m_checkBoxCustom; + wxBoxSizer* bSizerStdButtons; + wxButton* m_buttonAffirmative; + wxButton* m_buttonNegative; + wxButton* m_buttonCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnCheckBoxClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonAffirmative( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonNegative( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } + + +public: + + PopupDialogGenerated( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("dummy"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~PopupDialogGenerated(); + }; #endif //__POPUP_DLG_GENERATED_H__ |