Added support for RTL languages.

This commit is contained in:
Birunthan Mohanathas 2011-09-30 17:30:00 +00:00
parent 6594246bf4
commit e1aafc9705
5 changed files with 27 additions and 0 deletions

View File

@ -51,6 +51,17 @@ CDialog::~CDialog()
DeleteObject(m_FontBold); DeleteObject(m_FontBold);
} }
/*
** SetRTL
**
** Enables RTL layout.
**
*/
void CDialog::SetRTL()
{
SetWindowLong(m_Window, GWL_EXSTYLE, GetWindowLong(m_Window, GWL_EXSTYLE) | WS_EX_LAYOUTRTL);
}
/* /*
** SetDialogFont ** SetDialogFont
** **

View File

@ -28,6 +28,8 @@ protected:
CDialog(HWND wnd); CDialog(HWND wnd);
virtual ~CDialog(); virtual ~CDialog();
void SetRTL();
void SetDialogFont(); void SetDialogFont();
HWND m_Window; HWND m_Window;

View File

@ -218,6 +218,12 @@ INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam)
HICON hIcon = LoadIcon(Rainmeter->GetInstance(), MAKEINTRESOURCE(IDI_TRAY)); HICON hIcon = LoadIcon(Rainmeter->GetInstance(), MAKEINTRESOURCE(IDI_TRAY));
SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
if (wcscmp(GetString(ID_STR_ISRTL), L"1") == 0)
{
// Use RTL layout if using a RTL language
SetRTL();
}
HWND item = GetDlgItem(m_Window, IDC_ABOUT_TAB); HWND item = GetDlgItem(m_Window, IDC_ABOUT_TAB);
TCITEM tci = {0}; TCITEM tci = {0};
tci.mask = TCIF_TEXT; tci.mask = TCIF_TEXT;

View File

@ -202,6 +202,12 @@ INT_PTR CDialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam)
HICON hIcon = LoadIcon(Rainmeter->GetInstance(), MAKEINTRESOURCE(IDI_TRAY)); HICON hIcon = LoadIcon(Rainmeter->GetInstance(), MAKEINTRESOURCE(IDI_TRAY));
SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); SendMessage(m_Window, WM_SETICON, ICON_SMALL, (LPARAM)hIcon);
if (wcscmp(GetString(ID_STR_ISRTL), L"1") == 0)
{
// Use RTL layout if using a RTL language
SetRTL();
}
HWND item = GetDlgItem(m_Window, IDC_MANAGE_TAB); HWND item = GetDlgItem(m_Window, IDC_MANAGE_TAB);
TCITEM tci = {0}; TCITEM tci = {0};
tci.mask = TCIF_TEXT; tci.mask = TCIF_TEXT;

View File

@ -125,6 +125,8 @@
#define ID_STR_NEWVERSIONREQUIRED 2043 #define ID_STR_NEWVERSIONREQUIRED 2043
#define ID_STR_NOMETERSINSKIN 2044 #define ID_STR_NOMETERSINSKIN 2044
#define ID_STR_INCLUDEINFINITELOOP 2045 #define ID_STR_INCLUDEINFINITELOOP 2045
#define ID_STR_ABOUTRAINMETER 2046
#define ID_STR_MANAGERAINMETER 2047
#define ID_CONTEXT_REFRESH 4001 #define ID_CONTEXT_REFRESH 4001
#define ID_CONTEXT_QUIT 4002 #define ID_CONTEXT_QUIT 4002