Respect context-menu drop alignment
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@7295 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
41bb557cbc
commit
576d26d1b4
4 changed files with 8 additions and 4 deletions
|
@ -555,7 +555,7 @@ INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam
|
|||
GetClientRect(edit, &r);
|
||||
if (!PtInRect(&r, pt)) pt.x = pt.y = 0;
|
||||
MapWindowPoints(edit, HWND_DESKTOP, &pt, 1);
|
||||
TrackPopupMenu(g_sdata.editSubmenu, TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_sdata.hwnd, 0);
|
||||
TrackPopupMenu(g_sdata.editSubmenu, GetMenuDropAlignment() | TPM_LEFTBUTTON | TPM_RIGHTBUTTON, pt.x, pt.y, 0, g_sdata.hwnd, 0);
|
||||
}
|
||||
break;
|
||||
case TBN_DROPDOWN:
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#define SupportsW9X() ( sizeof(TCHAR) == 1 )
|
||||
#define SupportsW95() ( FALSE && SupportsW9X() && !DpiAwarePerMonitor() )
|
||||
#define SupportsW2000() ( sizeof(void*) == 4 )
|
||||
#define SupportsRTLUI() ( FALSE ) // UI is English only
|
||||
|
||||
static inline bool IsWin9598ME() { return SupportsW9X() && (int) GetVersion() < 0; }
|
||||
static inline bool IsWin95() { return SupportsW95() && (GetVersion() & (0x8000FFFF & ~0x0300)) == 0x80000004; }
|
||||
|
|
|
@ -195,16 +195,18 @@ void EnableToolBarButton(int cmdid, BOOL enabled)
|
|||
SendMessage(g_toolbar.hwnd, TB_SETSTATE, cmdid, MAKELPARAM(state, 0));
|
||||
}
|
||||
|
||||
static UINT IsRTL(HWND hWnd) { return ((UINT) GetWindowLongPtr(hWnd, GWL_EXSTYLE)) & (WS_EX_LAYOUTRTL); } // WS_EX_RIGHT? WS_EX_RTLREADING?
|
||||
static bool IsRTL(HWND hWnd) { return (((UINT) GetWindowLongPtr(hWnd, GWL_EXSTYLE)) & (WS_EX_LAYOUTRTL)) != 0; } // WS_EX_RIGHT? WS_EX_RTLREADING?
|
||||
|
||||
static UINT GetToolbarDropdownMenuPos(HWND hTB, UINT Id, POINT&pt)
|
||||
{
|
||||
RECT r;
|
||||
INT_PTR idx = SendMessage(hTB, TB_COMMANDTOINDEX, Id, 0);
|
||||
UINT tpm_align = GetMenuDropAlignment();
|
||||
bool ralign = tpm_align != TPM_LEFTALIGN, rtl = SupportsRTLUI() && IsRTL(hTB);
|
||||
SendMessage(hTB, TB_GETITEMRECT, idx, (LPARAM) &r);
|
||||
MapWindowPoints(hTB, NULL, (POINT*) &r, 2);
|
||||
pt.x = IsRTL(hTB) ? r.right : r.left, pt.y = r.bottom;
|
||||
return GetSystemMetrics(SM_MENUDROPALIGNMENT) ? TPM_RIGHTALIGN : TPM_LEFTALIGN;
|
||||
pt.x = (rtl ^ ralign) ? r.right : r.left, pt.y = r.bottom;
|
||||
return tpm_align | (rtl ? TPM_LAYOUTRTL : 0) | TPM_VERTICAL;
|
||||
}
|
||||
|
||||
static void ShowToolbarDropdownMenu(const NMTOOLBAR&nmtb, HWND hNotifyWnd, HMENU hParentMenu, UINT SubMenuId = -1)
|
||||
|
|
|
@ -138,6 +138,7 @@ bool FileExists(const TCHAR *fname);
|
|||
bool OpenUrlInDefaultBrowser(HWND hwnd, LPCSTR Url);
|
||||
|
||||
HMENU FindSubMenu(HMENU hMenu, UINT uId);
|
||||
static UINT GetMenuDropAlignment() { return GetSystemMetrics(SM_MENUDROPALIGNMENT) ? TPM_RIGHTALIGN : TPM_LEFTALIGN; }
|
||||
|
||||
typedef enum { CFF_RAWSIZE = 0x00, CFF_DPIPT = 0x01, CFF_DPIFROMHWND = 0x02 } CREATEFONTFLAGS;
|
||||
HFONT CreateFontHelper(INT_PTR Data, int Height, DWORD p1, LPCTSTR Face);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue