Additional resource-loading functions introduced
This commit is contained in:
parent
5483368640
commit
53e31b1be7
@ -20,8 +20,10 @@
|
|||||||
|
|
||||||
#include <wx/hyperlink.h>
|
#include <wx/hyperlink.h>
|
||||||
#include <wx/icon.h>
|
#include <wx/icon.h>
|
||||||
|
#include <wx/menuitem.h>
|
||||||
#include <wx/scrolwin.h>
|
#include <wx/scrolwin.h>
|
||||||
#include <wx/statbmp.h>
|
#include <wx/statbmp.h>
|
||||||
|
#include <wx/aui/auibar.h>
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
|
||||||
@ -90,11 +92,31 @@ template <class _Tcred, class _Tbase> class wxEAPCredentialsPanelBase;
|
|||||||
///
|
///
|
||||||
template <class _Tcred, class _Tbase> class wxPasswordCredentialsPanel;
|
template <class _Tcred, class _Tbase> class wxPasswordCredentialsPanel;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Loads icon from resource
|
||||||
|
///
|
||||||
|
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, int cx, int cy);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Loads icon from resource
|
||||||
|
///
|
||||||
|
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, const wxSize &size);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Sets icon from resource
|
/// Sets icon from resource
|
||||||
///
|
///
|
||||||
inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName);
|
inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sets icon from resource
|
||||||
|
///
|
||||||
|
inline bool wxSetIconFromResource(wxAuiToolBarItem *bmp, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName, const wxSize &size);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Sets icon from resource
|
||||||
|
///
|
||||||
|
inline bool wxSetIconFromResource(wxMenuItem *item, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Returns GUI displayable provider name
|
/// Returns GUI displayable provider name
|
||||||
///
|
///
|
||||||
@ -797,13 +819,36 @@ template <class _Tcred, class _Tbase>
|
|||||||
const wxStringCharType *wxPasswordCredentialsPanel<_Tcred, _Tbase>::s_dummy_password = wxT("dummypass");
|
const wxStringCharType *wxPasswordCredentialsPanel<_Tcred, _Tbase>::s_dummy_password = wxT("dummypass");
|
||||||
|
|
||||||
|
|
||||||
|
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, int cx, int cy)
|
||||||
|
{
|
||||||
|
HICON hIcon;
|
||||||
|
if (SUCCEEDED(LoadIconWithScaleDown(hinst, pszName, cx, cy, &hIcon))) {
|
||||||
|
wxIcon icon;
|
||||||
|
icon.CreateFromHICON(hIcon);
|
||||||
|
return icon;
|
||||||
|
} else
|
||||||
|
return wxNullIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline wxIcon wxLoadIconFromResource(HINSTANCE hinst, PCWSTR pszName, const wxSize &size)
|
||||||
|
{
|
||||||
|
HICON hIcon;
|
||||||
|
if (SUCCEEDED(LoadIconWithScaleDown(hinst, pszName, size.GetWidth(), size.GetHeight(), &hIcon))) {
|
||||||
|
wxIcon icon;
|
||||||
|
icon.CreateFromHICON(hIcon);
|
||||||
|
return icon;
|
||||||
|
} else
|
||||||
|
return wxNullIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName)
|
inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName)
|
||||||
{
|
{
|
||||||
wxASSERT(bmp);
|
wxASSERT(bmp);
|
||||||
|
|
||||||
HICON hIcon;
|
icon = wxLoadIconFromResource(hinst, pszName, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
|
||||||
if (SUCCEEDED(LoadIconWithScaleDown(hinst, pszName, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), &hIcon))) {
|
if (icon.IsOk()) {
|
||||||
icon.CreateFromHICON(hIcon);
|
|
||||||
bmp->SetIcon(icon);
|
bmp->SetIcon(icon);
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
@ -811,6 +856,33 @@ inline bool wxSetIconFromResource(wxStaticBitmap *bmp, wxIcon &icon, HINSTANCE h
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool wxSetIconFromResource(wxAuiToolBarItem *item, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName, const wxSize &size)
|
||||||
|
{
|
||||||
|
wxASSERT(item);
|
||||||
|
|
||||||
|
icon = wxLoadIconFromResource(hinst, pszName, size.GetWidth(), size.GetHeight());
|
||||||
|
if (icon.IsOk()) {
|
||||||
|
item->SetBitmap(icon);
|
||||||
|
item->SetDisabledBitmap(wxBitmap(icon).ConvertToDisabled());
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool wxSetIconFromResource(wxMenuItem *item, wxIcon &icon, HINSTANCE hinst, PCWSTR pszName)
|
||||||
|
{
|
||||||
|
wxASSERT(item);
|
||||||
|
|
||||||
|
icon = wxLoadIconFromResource(hinst, pszName, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON));
|
||||||
|
if (icon.IsOk()) {
|
||||||
|
item->SetBitmaps(icon);
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline wxString wxEAPGetProviderName(const std::wstring &id)
|
inline wxString wxEAPGetProviderName(const std::wstring &id)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user