From e1aafc970583a5edd745088363cc9c4c7031544a Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Fri, 30 Sep 2011 17:30:00 +0000 Subject: [PATCH] Added support for RTL languages. --- Library/Dialog.cpp | 11 +++++++++++ Library/Dialog.h | 2 ++ Library/DialogAbout.cpp | 6 ++++++ Library/DialogManage.cpp | 6 ++++++ Library/resource.h | 2 ++ 5 files changed, 27 insertions(+) diff --git a/Library/Dialog.cpp b/Library/Dialog.cpp index 0b3531fb..53c73829 100644 --- a/Library/Dialog.cpp +++ b/Library/Dialog.cpp @@ -51,6 +51,17 @@ CDialog::~CDialog() DeleteObject(m_FontBold); } +/* +** SetRTL +** +** Enables RTL layout. +** +*/ +void CDialog::SetRTL() +{ + SetWindowLong(m_Window, GWL_EXSTYLE, GetWindowLong(m_Window, GWL_EXSTYLE) | WS_EX_LAYOUTRTL); +} + /* ** SetDialogFont ** diff --git a/Library/Dialog.h b/Library/Dialog.h index ab363cd6..7849fe4e 100644 --- a/Library/Dialog.h +++ b/Library/Dialog.h @@ -28,6 +28,8 @@ protected: CDialog(HWND wnd); virtual ~CDialog(); + void SetRTL(); + void SetDialogFont(); HWND m_Window; diff --git a/Library/DialogAbout.cpp b/Library/DialogAbout.cpp index 7e47dd5a..99f2acc3 100644 --- a/Library/DialogAbout.cpp +++ b/Library/DialogAbout.cpp @@ -218,6 +218,12 @@ INT_PTR CDialogAbout::OnInitDialog(WPARAM wParam, LPARAM lParam) HICON hIcon = LoadIcon(Rainmeter->GetInstance(), MAKEINTRESOURCE(IDI_TRAY)); 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); TCITEM tci = {0}; tci.mask = TCIF_TEXT; diff --git a/Library/DialogManage.cpp b/Library/DialogManage.cpp index 9356b517..bdccc71e 100644 --- a/Library/DialogManage.cpp +++ b/Library/DialogManage.cpp @@ -202,6 +202,12 @@ INT_PTR CDialogManage::OnInitDialog(WPARAM wParam, LPARAM lParam) HICON hIcon = LoadIcon(Rainmeter->GetInstance(), MAKEINTRESOURCE(IDI_TRAY)); 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); TCITEM tci = {0}; tci.mask = TCIF_TEXT; diff --git a/Library/resource.h b/Library/resource.h index 5895f5b9..a9054010 100644 --- a/Library/resource.h +++ b/Library/resource.h @@ -125,6 +125,8 @@ #define ID_STR_NEWVERSIONREQUIRED 2043 #define ID_STR_NOMETERSINSKIN 2044 #define ID_STR_INCLUDEINFINITELOOP 2045 +#define ID_STR_ABOUTRAINMETER 2046 +#define ID_STR_MANAGERAINMETER 2047 #define ID_CONTEXT_REFRESH 4001 #define ID_CONTEXT_QUIT 4002