added rtl support
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5214 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
16e6702900
commit
b7b224bd68
2 changed files with 88 additions and 0 deletions
79
Contrib/nsDialogs/rtl.c
Normal file
79
Contrib/nsDialogs/rtl.c
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
#include <windows.h>
|
||||||
|
#include <commctrl.h>
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
|
#include "nsis.h"
|
||||||
|
|
||||||
|
extern struct nsDialog g_dialog;
|
||||||
|
|
||||||
|
void __declspec(dllexport) SetRTL(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters *extra)
|
||||||
|
{
|
||||||
|
g_dialog.rtl = (BOOL) popint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NSDFUNC ConvertStyleToRTL(enum nsControlType type, LPDWORD style, LPDWORD exStyle)
|
||||||
|
{
|
||||||
|
if (!g_dialog.rtl)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case NSCTL_BUTTON:
|
||||||
|
*style ^= BS_LEFTTEXT | BS_RIGHT | BS_LEFT;
|
||||||
|
|
||||||
|
if ((*style & (BS_LEFT|BS_RIGHT)) == (BS_LEFT|BS_RIGHT))
|
||||||
|
{
|
||||||
|
*style ^= BS_LEFT | BS_RIGHT;
|
||||||
|
if (*style & (BS_RADIOBUTTON | BS_CHECKBOX | BS_USERBUTTON))
|
||||||
|
{
|
||||||
|
*style |= BS_RIGHT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSCTL_EDIT:
|
||||||
|
if ((*style & ES_CENTER) == 0)
|
||||||
|
{
|
||||||
|
*style ^= ES_RIGHT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSCTL_STATIC:
|
||||||
|
if ((*style & SS_TYPEMASK) == SS_LEFT || (*style & SS_TYPEMASK) == SS_LEFTNOWORDWRAP)
|
||||||
|
{
|
||||||
|
*style &= ~SS_TYPEMASK;
|
||||||
|
*style |= SS_RIGHT;
|
||||||
|
}
|
||||||
|
else if ((*style & SS_TYPEMASK) == SS_ICON) {
|
||||||
|
*style |= SS_CENTERIMAGE;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSCTL_RICHEDIT:
|
||||||
|
case NSCTL_RICHEDIT2:
|
||||||
|
if ((*style & ES_CENTER) == 0)
|
||||||
|
{
|
||||||
|
*style ^= ES_RIGHT;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NSCTL_TREE:
|
||||||
|
*style |= TVS_RTLREADING;
|
||||||
|
*exStyle |= WS_EX_RIGHT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
*exStyle |= WS_EX_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*exStyle |= WS_EX_RTLREADING | WS_EX_LEFTSCROLLBAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NSDFUNC ConvertPosToRTL(int *x, int width, int dialogWidth)
|
||||||
|
{
|
||||||
|
if (!g_dialog.rtl)
|
||||||
|
return;
|
||||||
|
|
||||||
|
*x = dialogWidth - width - *x;
|
||||||
|
}
|
9
Contrib/nsDialogs/rtl.h
Normal file
9
Contrib/nsDialogs/rtl.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef __NS_DIALOGS__RTL_H__
|
||||||
|
#define __NS_DIALOGS__RTL_H__
|
||||||
|
|
||||||
|
#include "defs.h"
|
||||||
|
|
||||||
|
void NSDFUNC ConvertStyleToRTL(enum nsControlType type, LPDWORD style, LPDWORD exStyle);
|
||||||
|
void NSDFUNC ConvertPosToRTL(int *x, int width, int dialogWidth);
|
||||||
|
|
||||||
|
#endif//__NS_DIALOGS__RTL_H__
|
Loading…
Add table
Add a link
Reference in a new issue