gtk: also use TPopupMenu.IsRightToLeft to determine the popup position

git-svn-id: trunk@22737 -
This commit is contained in:
paul 2009-11-24 08:44:15 +00:00
parent 58c78a36ab
commit de89e6efe0
2 changed files with 15 additions and 3 deletions

View File

@ -2475,8 +2475,8 @@ customise by choosing various menu items. <var>TPopupMenu</var> is a menu window
<short>
<var>TPopupAlignment</var> - enumerated type to describe the position of popup menu relative to the popup coordinate</short>
<descr>
<pre>paLeft - open popup menu left of the popup corrdinate
paRight - open popup menu right of popup corrdinate
<pre>paLeft - position popup menu so it left corner is at the popup coordinate
paRight - position popup menu menu so it right corner is at the popup corrdinate
paCenter - center popup menu around popup corrdinate
</pre>
</descr>

View File

@ -367,13 +367,25 @@ procedure GtkWS_Popup(menu: PGtkMenu; X, Y: pgint;
WidgetInfo: PWidgetInfo); cdecl;
var
Requisition: TGtkRequisition;
Alignment: TPopupAlignment;
begin
X^ := PPoint(WidgetInfo^.UserData)^.X;
Y^ := PPoint(WidgetInfo^.UserData)^.Y;
if WidgetInfo^.LCLObject is TPopupMenu then
begin
case TPopupMenu(WidgetInfo^.LCLObject).Alignment of
// get actual alignment
Alignment := TPopupMenu(WidgetInfo^.LCLObject).Alignment;
if TPopupMenu(WidgetInfo^.LCLObject).IsRightToLeft then
begin
if Alignment = paLeft then
Alignment := paRight
else
if Alignment = paRight then
Alignment := paLeft;
end;
case Alignment of
paCenter:
begin
gtk_widget_size_request(PGtkWidget(menu), @Requisition);