mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 05:18:00 +02:00
- BidiMode patch from Zaher Dirkey (0008996) part 1
git-svn-id: trunk@11408 -
This commit is contained in:
parent
1aa10e864e
commit
d5c7e43700
@ -422,6 +422,7 @@ type
|
||||
procedure WMPaint(var message: TLMPaint); message LM_PAINT;
|
||||
procedure WMShowWindow(var message: TLMShowWindow); message LM_SHOWWINDOW;
|
||||
procedure WMSize(var message: TLMSize); message LM_Size;
|
||||
procedure CMBiDiModeChanged(var Message: TLMessage); message CM_BIDIMODECHANGED;
|
||||
procedure AddHandler(HandlerType: TFormHandlerType;
|
||||
const Handler: TMethod; AsLast: Boolean);
|
||||
procedure RemoveHandler(HandlerType: TFormHandlerType;
|
||||
@ -1800,3 +1801,4 @@ finalization
|
||||
end.
|
||||
|
||||
|
||||
|
||||
|
@ -289,6 +289,12 @@ begin
|
||||
Result:=BorderSpacing.InnerBorder<>2;
|
||||
end;
|
||||
|
||||
function TCustomButton.UseRightToLeftAlignment: Boolean;
|
||||
begin
|
||||
//Button always has center alignment
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TCustomButton.DoSendBtnDefault;
|
||||
------------------------------------------------------------------------------}
|
||||
@ -307,3 +313,4 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
@ -574,6 +574,30 @@ begin
|
||||
end;
|
||||
End;
|
||||
|
||||
procedure TCustomForm.CMBiDiModeChanged(var Message: TLMessage);
|
||||
var
|
||||
i:Integer;
|
||||
lMessage:TLMessage;
|
||||
begin
|
||||
inherited;
|
||||
//send CM_PARENTBIDIMODECHANGED to All Component owned by Form
|
||||
{ prefer use IMenu and check it then call IMenu.ParentBidiMode
|
||||
This way is usefull for other TMenu components that need BidiMode of form changed
|
||||
Like as TToolbar }
|
||||
lMessage.msg := CM_PARENTBIDIMODECHANGED;
|
||||
lMessage.wParam := 0;
|
||||
lMessage.lParam := 0;
|
||||
lMessage.Result := 0;
|
||||
for i := 0 to ComponentCount - 1 do
|
||||
begin
|
||||
if not (Components[i] is TCustomControl) then//TCustomControl already has this notification
|
||||
Components[i].Dispatch(lMessage);
|
||||
//the old way
|
||||
// if Components[i] is TMenu then
|
||||
// TMenu(Components[i]).ParentBiDiModeChanged;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomForm.AddHandler(HandlerType: TFormHandlerType;
|
||||
const Handler: TMethod; AsLast: Boolean);
|
||||
begin
|
||||
|
@ -32,6 +32,9 @@ begin
|
||||
FItems.FMenu := Self;
|
||||
FImageChangeLink := TChangeLink.Create;
|
||||
FImageChangeLink.OnChange := @ImageListChange;
|
||||
FBidiMode := bdLeftToRight;
|
||||
FParentBidiMode := True;
|
||||
ParentBidiModeChanged(AOwner);
|
||||
Inherited Create(AOwner);
|
||||
end;
|
||||
|
||||
@ -46,6 +49,55 @@ begin
|
||||
FImages:=AValue;
|
||||
end;
|
||||
|
||||
procedure TMenu.SetBidiMode(const AValue: TBidiMode);
|
||||
begin
|
||||
if FBidiMode=AValue then exit;
|
||||
FBidiMode:=AValue;
|
||||
FParentBiDiMode := False;
|
||||
if not (csLoading in ComponentState) then
|
||||
BidiModeChanged;
|
||||
end;
|
||||
|
||||
procedure TMenu.SetParentBidiMode(const AValue: Boolean);
|
||||
begin
|
||||
if FParentBiDiMode = AValue then exit;
|
||||
FParentBiDiMode := AValue;
|
||||
if not (csLoading in ComponentState) then
|
||||
ParentBidiModeChanged;
|
||||
end;
|
||||
|
||||
procedure TMenu.CMParentBiDiModeChanged(var Message: TLMessage);
|
||||
begin
|
||||
ParentBidiModeChanged;
|
||||
end;
|
||||
|
||||
procedure TMenu.BidiModeChanged;
|
||||
begin
|
||||
if HandleAllocated then
|
||||
TWSMenuClass(WidgetSetClass).BiDiModeChanged(Self);
|
||||
end;
|
||||
|
||||
procedure TMenu.ParentBidiModeChanged(AOwner: TComponent);
|
||||
begin
|
||||
if FParentBidiMode then
|
||||
begin
|
||||
//Take the value from the Owner
|
||||
//i can not use parent because TPopupMenu.Parent = nil
|
||||
if (AOwner<>nil)
|
||||
and (AOwner is TCustomForm)
|
||||
and not (csDestroying in AOwner.ComponentState) then
|
||||
begin
|
||||
BiDiMode := TCustomForm(AOwner).BiDiMode;
|
||||
FParentBiDiMode := True;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMenu.ParentBidiModeChanged;
|
||||
begin
|
||||
ParentBidiModeChanged(Owner);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
procedure TMenu.SetParent(const AValue: TComponent);
|
||||
|
||||
@ -57,7 +109,7 @@ begin
|
||||
if (FParent=nil) and (Items<>nil) and Items.HandleAllocated then begin
|
||||
// disconnect from form
|
||||
DestroyHandle;
|
||||
end;
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TMenu.ImageListChange(Sender: TObject);
|
||||
@ -270,6 +322,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMenu.IsBiDiModeStored: boolean;
|
||||
begin
|
||||
Result := not FParentBidiMode;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TMenu.IsRightToLeft
|
||||
Params:
|
||||
@ -279,8 +336,7 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
function TMenu.IsRightToLeft : Boolean;
|
||||
Begin
|
||||
//TODO: Make sure it should return FALSE!!!!!!!!!!
|
||||
Result := False;
|
||||
Result := BidiMode <> bdLeftToRight;
|
||||
end;
|
||||
|
||||
// included by menus.pp
|
||||
|
@ -531,6 +531,20 @@ begin
|
||||
Result := Item.FMenu;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TMenuItem.GetIsRightToLeft
|
||||
Returns: Get IsRightToLeft value from Menu
|
||||
|
||||
------------------------------------------------------------------------------}
|
||||
|
||||
function TMenuItem.GetIsRightToLeft: Boolean;
|
||||
var
|
||||
LMenu:TMenu;
|
||||
begin
|
||||
LMenu := GetParentMenu;
|
||||
Result := (LMenu <> nil) and (LMenu.IsRightToLeft);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: TMenuItem.HandleAllocated
|
||||
Params: None
|
||||
|
@ -809,7 +809,6 @@ Var
|
||||
procedure HandleSpinEditChange(ASpinEdit: TCustomFloatSpinEdit);
|
||||
var
|
||||
lWindowInfo: PWindowInfo;
|
||||
NewValue: single;
|
||||
begin
|
||||
lWindowInfo := GetWindowInfo(ASpinEdit.Handle);
|
||||
if lWindowInfo = @DefaultWindowInfo then exit;
|
||||
|
@ -493,6 +493,8 @@ begin
|
||||
begin
|
||||
AWinControl := TWinControl(AMenu.Owner);
|
||||
Windows.SetMenu(AWinControl.Handle, AMenu.Handle);
|
||||
//Set the right order menu after attach the menu
|
||||
SetMenuFlag(AMenu.Handle, MFT_RIGHTORDER or MFT_RIGHTJUSTIFY, AMenu.IsRightToLeft);
|
||||
AddToChangedMenus(AWinControl.Handle);
|
||||
end;
|
||||
end;
|
||||
|
@ -108,6 +108,7 @@ procedure AddToChangedMenus(Window: HWnd);
|
||||
procedure RedrawMenus;
|
||||
function MeasureText(const AWinControl: TWinControl; Text: string; var Width, Height: integer): boolean;
|
||||
function GetControlText(AHandle: HWND): string;
|
||||
procedure SetMenuFlag(const Menu:HMenu; Flag: Integer; Value: boolean);
|
||||
|
||||
type
|
||||
PDisableWindowsInfo = ^TDisableWindowsInfo;
|
||||
@ -1103,6 +1104,28 @@ begin
|
||||
ChangedMenus.Clear;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: SetMenuFlags
|
||||
Returns: Nothing
|
||||
|
||||
Change the menu flags for handle of TMenuItem or TMenu,
|
||||
added for BidiMode Menus
|
||||
------------------------------------------------------------------------------}
|
||||
procedure SetMenuFlag(const Menu:HMenu; Flag: Integer; Value: boolean);
|
||||
var
|
||||
MenuInfo: MENUITEMINFO;
|
||||
begin
|
||||
FillChar(MenuInfo, SizeOf(MenuInfo), 0);
|
||||
MenuInfo.cbSize := SizeOf(MENUITEMINFO);
|
||||
MenuInfo.fMask := MIIM_FTYPE;
|
||||
GetMenuItemInfo(Menu, 0, True, @MenuInfo);
|
||||
if Value then
|
||||
MenuInfo.fType := MenuInfo.fType or Flag
|
||||
else
|
||||
MenuInfo.fType := MenuInfo.fType and not Flag;
|
||||
SetMenuItemInfo(Menu, 0, True, @MenuInfo);
|
||||
end;
|
||||
|
||||
function MeasureText(const AWinControl: TWinControl; Text: string; var Width, Height: integer): boolean;
|
||||
var
|
||||
textSize: Windows.SIZE;
|
||||
|
@ -74,6 +74,7 @@ type
|
||||
class procedure AddControl(const AControl: TControl); override;
|
||||
|
||||
class function GetText(const AWinControl: TWinControl; var AText: String): Boolean; override;
|
||||
class procedure SetBiDiMode(const AWinControl: TWinControl; const ABiDiMode: TBiDiMode); override;
|
||||
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
|
||||
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
|
||||
class procedure SetChildZPosition(const AWinControl, AChild: TWinControl;
|
||||
@ -137,6 +138,10 @@ procedure FinishCreateWindow(const AWinControl: TWinControl; var Params: TCreate
|
||||
const AlternateCreateWindow: boolean);
|
||||
procedure WindowCreateInitBuddy(const AWinControl: TWinControl;
|
||||
var Params: TCreateWindowExParams);
|
||||
|
||||
// Must be in win32proc but TCreateWindowExParams declared here
|
||||
procedure SetStdBiDiModeParams(const AWinControl: TWinControl; var Params:TCreateWindowExParams);
|
||||
procedure UpdateStdBiDiModeFlags(const AWinControl: TWinControl);
|
||||
|
||||
implementation
|
||||
|
||||
@ -182,6 +187,7 @@ begin
|
||||
if AWinControl is TCustomControl then
|
||||
if TCustomControl(AWinControl).BorderStyle = bsSingle then
|
||||
FlagsEx := FlagsEx or WS_EX_CLIENTEDGE;
|
||||
SetStdBiDiModeParams(AWinControl, Params);
|
||||
{$IFDEF VerboseSizeMsg}
|
||||
writeln('TWin32WidgetSet.CreateComponent A ',AWinControl.Name,':',AWinControl.ClassName,' ',Left,',',Top,',',Width,',',Height);
|
||||
{$ENDIF}
|
||||
@ -280,6 +286,38 @@ begin
|
||||
BuddyWindowInfo := nil;
|
||||
end;
|
||||
|
||||
procedure SetStdBiDiModeParams(const AWinControl: TWinControl; var Params:TCreateWindowExParams);
|
||||
begin
|
||||
with Params do
|
||||
begin
|
||||
//remove old bidimode ExFlags
|
||||
FlagsEx := FlagsEx and not(WS_EX_RTLREADING or WS_EX_RIGHT or WS_EX_LEFTSCROLLBAR);
|
||||
|
||||
if AWinControl.UseRightToLeftAlignment then
|
||||
FlagsEx := FlagsEx or WS_EX_LEFTSCROLLBAR or WS_EX_RIGHT;
|
||||
if AWinControl.UseRightToLeftReading then
|
||||
FlagsEx := FlagsEx or WS_EX_RTLREADING;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure UpdateStdBiDiModeFlags(const AWinControl: TWinControl);
|
||||
var
|
||||
FlagsEx: dword;
|
||||
begin
|
||||
//UpdateStdBiDiModeFlags must called after form loaded when the BidiMode changed at run time
|
||||
if not WSCheckHandleAllocated(AWinControl, 'UpdateStdBiDiModeFlags') then Exit;
|
||||
|
||||
FlagsEx := GetWindowLong(AWinControl.Handle, GWL_EXSTYLE);
|
||||
FlagsEx := FlagsEx and not (WS_EX_RTLREADING or WS_EX_RIGHT or WS_EX_LEFTSCROLLBAR);
|
||||
if AWinControl.UseRightToLeftAlignment then
|
||||
FlagsEx := FlagsEx or WS_EX_RIGHT;
|
||||
if AWinControl.UseRightToLeftReading then
|
||||
FlagsEx := FlagsEx or WS_EX_RTLREADING ;
|
||||
if AWinControl.UseRightToLeftScrollBar then
|
||||
FlagsEx := FlagsEx or WS_EX_LEFTSCROLLBAR;
|
||||
SetWindowLong(AWinControl.Handle, GWL_EXSTYLE, FlagsEx);
|
||||
end;
|
||||
|
||||
{ TWin32WSWinControl }
|
||||
|
||||
class function TWin32WSWinControl.CreateHandle(const AWinControl: TWinControl;
|
||||
@ -332,6 +370,12 @@ begin
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
class procedure TWin32WSWinControl.SetBiDiMode(const AWinControl: TWinControl;
|
||||
const ABiDiMode: TBiDiMode);
|
||||
begin
|
||||
UpdateStdBiDiModeFlags(AWinControl);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSWinControl.SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle);
|
||||
begin
|
||||
RecreateWnd(AWinControl);
|
||||
|
@ -245,14 +245,8 @@ begin
|
||||
( not (csDesigning in lForm.ComponentState) and
|
||||
(lForm.ShowInTaskBar = stAlways)) then
|
||||
Parent := 0;
|
||||
with Params do {BidiMode}
|
||||
begin
|
||||
if AWinControl.UseRightToLeftAlignment then
|
||||
FlagsEx := FlagsEx or WS_EX_LEFTSCROLLBAR or WS_EX_RIGHT;
|
||||
if AWinControl.UseRightToLeftReading then
|
||||
FlagsEx := FlagsEx or WS_EX_RTLREADING ;
|
||||
end;
|
||||
end;
|
||||
SetStdBiDiModeParams(AWinControl, Params);
|
||||
// create window
|
||||
FinishCreateWindow(AWinControl, Params, false);
|
||||
// TODO: proper icon, for now set default icon
|
||||
|
@ -62,6 +62,7 @@ type
|
||||
protected
|
||||
public
|
||||
class function CreateHandle(const AMenu: TMenu): HMENU; override;
|
||||
class procedure BiDiModeChanged(const AMenu: TMenu); override;
|
||||
end;
|
||||
|
||||
{ TWin32WSMainMenu }
|
||||
@ -501,7 +502,13 @@ begin
|
||||
end;
|
||||
dwTypeData := PChar(AMenuItem);
|
||||
if AMenuItem.RadioItem then fType := fType or MFT_RADIOCHECK;
|
||||
if AMenuItem.RightJustify then fType := fType or MFT_RIGHTJUSTIFY;
|
||||
if (AMenuItem.GetIsRightToLeft) then
|
||||
begin
|
||||
fType := fType or MFT_RIGHTORDER;
|
||||
//Reverse the RIGHTJUSTIFY to be left
|
||||
if not AMenuItem.RightJustify then fType := fType or MFT_RIGHTJUSTIFY;
|
||||
end
|
||||
else if AMenuItem.RightJustify then fType := fType or MFT_RIGHTJUSTIFY;
|
||||
end;
|
||||
if dword(InsertMenuItem(ParentMenuHandle,
|
||||
AMenuItem.Parent.VisibleIndexOf(AMenuItem), true, @MenuInfo)) = 0 then
|
||||
@ -557,6 +564,20 @@ begin
|
||||
Result := CreateMenu;
|
||||
end;
|
||||
|
||||
class procedure TWin32WSMenu.BiDiModeChanged(const AMenu: TMenu);
|
||||
begin
|
||||
if AMenu.HandleAllocated then
|
||||
begin
|
||||
SetMenuFlag(AMenu.Handle, MFT_RIGHTORDER or MFT_RIGHTJUSTIFY, AMenu.IsRightToLeft);
|
||||
//TriggerFormUpdate not take TMenu, we repeate the code
|
||||
if (AMenu<>nil) and (AMenu.Parent<>nil)
|
||||
and (AMenu.Parent is TCustomForm)
|
||||
and TCustomForm(AMenu.Parent).HandleAllocated
|
||||
and not (csDestroying in AMenu.Parent.ComponentState) then
|
||||
AddToChangedMenus(TCustomForm(AMenu.Parent).Handle);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TWin32WSPopupMenu }
|
||||
|
||||
class function TWin32WSPopupMenu.CreateHandle(const AMenu: TMenu): HMENU;
|
||||
@ -568,11 +589,13 @@ class procedure TWin32WSPopupMenu.Popup(const APopupMenu: TPopupMenu; const X, Y
|
||||
var
|
||||
MenuHandle: HMENU;
|
||||
AppHandle: HWND;
|
||||
const
|
||||
lAlign: array[Boolean] of Word = (TPM_LEFTALIGN, TPM_RIGHTALIGN);
|
||||
begin
|
||||
MenuHandle := APopupMenu.Handle;
|
||||
AppHandle := TWin32WidgetSet(WidgetSet).AppHandle;
|
||||
GetWindowInfo(AppHandle)^.PopupMenu := APopupMenu;
|
||||
TrackPopupMenuEx(MenuHandle, TPM_LEFTALIGN or TPM_LEFTBUTTON or TPM_RIGHTBUTTON,
|
||||
TrackPopupMenuEx(MenuHandle, lAlign[APopupMenu.IsRightToLeft] or TPM_LEFTBUTTON or TPM_RIGHTBUTTON,
|
||||
X, Y, AppHandle, Nil);
|
||||
end;
|
||||
|
||||
|
@ -62,6 +62,7 @@ type
|
||||
const AParams: TCreateParams): HWND; override;
|
||||
class procedure AdaptBounds(const AWinControl: TWinControl;
|
||||
var Left, Top, Width, Height: integer; var SuppressMove: boolean); override;
|
||||
class procedure SetBiDiMode(const AWinControl: TWinControl; const ABiDiMode: TBiDiMode); override;
|
||||
end;
|
||||
|
||||
{ TWin32WSGroupBox }
|
||||
@ -161,7 +162,6 @@ type
|
||||
class function GetMaxLength(const ACustomEdit: TCustomEdit): integer; {override;}
|
||||
class function GetText(const AWinControl: TWinControl; var AText: string): boolean; override;
|
||||
|
||||
class procedure SetBiDiMode(const AWinControl: TWinControl; const ABiDiMode: TBiDiMode); override;
|
||||
class procedure SetCharCase(const ACustomEdit: TCustomEdit; NewCase: TEditCharCase); override;
|
||||
class procedure SetEchoMode(const ACustomEdit: TCustomEdit; NewMode: TEchoMode); override;
|
||||
class procedure SetMaxLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
|
||||
@ -241,7 +241,6 @@ type
|
||||
public
|
||||
class function CreateHandle(const AWinControl: TWinControl;
|
||||
const AParams: TCreateParams): HWND; override;
|
||||
class procedure SetBiDiMode(const AWinControl: TWinControl; const ABiDiMode: TBiDiMode); override;
|
||||
class procedure SetDefault(const AButton: TCustomButton; ADefault: Boolean); override;
|
||||
class procedure SetShortCut(const AButton: TCustomButton; const OldKey, NewKey: word); override;
|
||||
end;
|
||||
@ -260,6 +259,7 @@ type
|
||||
class function RetrieveState(const ACustomCheckBox: TCustomCheckBox): TCheckBoxState; override;
|
||||
class procedure SetShortCut(const ACustomCheckBox: TCustomCheckBox;
|
||||
const OldShortCut, NewShortCut: TShortCut); override;
|
||||
class procedure SetBiDiMode(const AWinControl: TWinControl; const ABiDiMode: TBiDiMode); override;
|
||||
class procedure SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState); override;
|
||||
end;
|
||||
|
||||
@ -458,6 +458,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomGroupBox.SetBiDiMode(
|
||||
const AWinControl: TWinControl; const ABiDiMode: TBiDiMode);
|
||||
begin
|
||||
RecreateWnd(AWinControl);
|
||||
end;
|
||||
|
||||
{ TWin32WSCustomListBox }
|
||||
|
||||
class procedure TWin32WSCustomListBox.AdaptBounds(
|
||||
@ -887,13 +893,6 @@ begin
|
||||
pClassName := 'EDIT';
|
||||
WindowTitle := StrCaption;
|
||||
Flags := Flags or ES_AUTOHSCROLL;
|
||||
with Params do {BidiMode}
|
||||
begin
|
||||
if AWinControl.UseRightToLeftAlignment then
|
||||
FlagsEx := FlagsEx or WS_EX_LEFTSCROLLBAR or WS_EX_RIGHT;
|
||||
if AWinControl.UseRightToLeftReading then
|
||||
FlagsEx := FlagsEx or WS_EX_RTLREADING ;
|
||||
end;
|
||||
end;
|
||||
// create window
|
||||
FinishCreateWindow(AWinControl, Params, false);
|
||||
@ -925,12 +924,6 @@ begin
|
||||
AText := GetControlText(AWinControl.Handle);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomEdit.SetBiDiMode(const AWinControl: TWinControl;
|
||||
const ABiDiMode: TBiDiMode);
|
||||
begin
|
||||
RecreateWnd(AWinControl);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomEdit.SetCharCase(const ACustomEdit: TCustomEdit; NewCase: TEditCharCase);
|
||||
const
|
||||
EditStyles: array[TEditCharCase] of integer = (0, ES_UPPERCASE, ES_LOWERCASE);
|
||||
@ -1121,11 +1114,6 @@ begin
|
||||
Flags := Flags or BS_DEFPUSHBUTTON
|
||||
else
|
||||
Flags := Flags or BS_PUSHBUTTON;
|
||||
with Params do {BidiMode}
|
||||
begin
|
||||
if AWinControl.UseRightToLeftReading then
|
||||
FlagsEx := FlagsEx or WS_EX_RTLREADING;
|
||||
end;
|
||||
pClassName := 'BUTTON';
|
||||
WindowTitle := StrCaption;
|
||||
end;
|
||||
@ -1134,12 +1122,6 @@ begin
|
||||
Result := Params.Window;
|
||||
end;
|
||||
|
||||
class procedure TWin32WSButton.SetBiDiMode(const AWinControl: TWinControl;
|
||||
const ABiDiMode: TBiDiMode);
|
||||
begin
|
||||
RecreateWnd(AWinControl);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSButton.SetDefault(const AButton: TCustomButton; ADefault: Boolean);
|
||||
var
|
||||
WindowStyle: dword;
|
||||
@ -1219,6 +1201,13 @@ begin
|
||||
// TODO: implement me!
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomCheckBox.SetBiDiMode(
|
||||
const AWinControl: TWinControl; const ABiDiMode: TBiDiMode);
|
||||
begin
|
||||
// UpdateStdBiDiModeFlags(AWinControl); not worked
|
||||
RecreateWnd(AWinControl);
|
||||
end;
|
||||
|
||||
class procedure TWin32WSCustomCheckBox.SetState(const ACustomCheckBox: TCustomCheckBox; const NewState: TCheckBoxState);
|
||||
var
|
||||
Flags: WPARAM;
|
||||
|
20
lcl/menus.pp
20
lcl/menus.pp
@ -189,6 +189,7 @@ type
|
||||
function GetImageList: TCustomImageList; virtual;
|
||||
function GetParentComponent: TComponent; override;
|
||||
function GetParentMenu: TMenu; virtual;
|
||||
function GetIsRightToLeft:Boolean; virtual;
|
||||
function HandleAllocated : Boolean;
|
||||
function HasIcon: boolean; virtual;
|
||||
function HasParent: Boolean; override;
|
||||
@ -268,25 +269,36 @@ type
|
||||
|
||||
TMenu = class(TLCLComponent)
|
||||
private
|
||||
FBiDiMode: TBiDiMode;
|
||||
FImageChangeLink: TChangeLink;
|
||||
FImages: TCustomImageList;
|
||||
FItems: TMenuItem;
|
||||
FOnChange: TMenuChangeEvent;
|
||||
FParent: TComponent;
|
||||
FParentBiDiMode: Boolean;
|
||||
FShortcutHandled: boolean;
|
||||
//See TCustomForm.CMBiDiModeChanged
|
||||
procedure CMParentBiDiModeChanged(var Message: TLMessage); message CM_PARENTBIDIMODECHANGED;
|
||||
function IsBiDiModeStored: Boolean;
|
||||
procedure ImageListChange(Sender: TObject);
|
||||
procedure SetBiDiMode(const AValue: TBiDiMode);
|
||||
procedure SetImages(const AValue: TCustomImageList);
|
||||
procedure SetParent(const AValue: TComponent);
|
||||
procedure ImageListChange(Sender: TObject);
|
||||
procedure SetParentBiDiMode(const AValue: Boolean);
|
||||
protected
|
||||
procedure BidiModeChanged; virtual;
|
||||
procedure CreateHandle; virtual;
|
||||
procedure DoChange(Source: TMenuItem; Rebuild: Boolean); virtual;
|
||||
function GetHandle: HMENU; virtual;
|
||||
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
|
||||
procedure MenuChanged(Sender: TObject; Source: TMenuItem;
|
||||
Rebuild: Boolean); virtual;
|
||||
property OnChange: TMenuChangeEvent read FOnChange write FOnChange;
|
||||
procedure ParentBidiModeChanged;
|
||||
procedure ParentBidiModeChanged(AOwner:TComponent);//used in Create constructor
|
||||
procedure SetChildOrder(Child: TComponent; Order: Integer); override;
|
||||
procedure UpdateItems;
|
||||
|
||||
property OnChange: TMenuChangeEvent read FOnChange write FOnChange;
|
||||
public
|
||||
FCompStyle: LongInt;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
@ -295,7 +307,7 @@ type
|
||||
function FindItem(AValue: PtrInt; Kind: TFindItemKind) : TMenuItem;
|
||||
function IsShortcut(var Message: TLMKey): boolean;
|
||||
function HandleAllocated: Boolean;
|
||||
Function IsRightToLeft: Boolean;
|
||||
function IsRightToLeft: Boolean; virtual;
|
||||
procedure HandleNeeded;
|
||||
function DispatchCommand(ACommand: Word): Boolean;
|
||||
public
|
||||
@ -303,6 +315,8 @@ type
|
||||
property Parent: TComponent read FParent write SetParent;
|
||||
property ShortcutHandled: boolean read FShortcutHandled write FShortcutHandled;
|
||||
published
|
||||
property BidiMode:TBidiMode read FBidiMode write SetBidiMode stored IsBiDiModeStored default bdLeftToRight;
|
||||
property ParentBidiMode:Boolean read FParentBidiMode write SetParentBidiMode default True;
|
||||
property Items: TMenuItem read FItems;
|
||||
property Images: TCustomImageList read FImages write SetImages;
|
||||
end;
|
||||
|
@ -119,6 +119,7 @@ type
|
||||
published
|
||||
property Align;
|
||||
property Anchors;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property Constraints;
|
||||
property Ctl3D;
|
||||
@ -131,6 +132,7 @@ type
|
||||
property Max;
|
||||
property Min;
|
||||
property PageSize;
|
||||
property ParentBidiMode;
|
||||
property ParentCtl3D;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
@ -170,6 +172,7 @@ type
|
||||
property Align;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property Caption;
|
||||
property ChildSizing;
|
||||
@ -184,6 +187,7 @@ type
|
||||
property DragMode;
|
||||
property Enabled;
|
||||
property Font;
|
||||
property ParentBidiMode;
|
||||
property ParentColor;
|
||||
property ParentCtl3D;
|
||||
property ParentFont;
|
||||
@ -382,6 +386,7 @@ type
|
||||
property AutoCompleteText;
|
||||
property AutoDropDown;
|
||||
property AutoSelect;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property CharCase;
|
||||
property Color;
|
||||
@ -418,6 +423,7 @@ type
|
||||
property OnMouseUp;
|
||||
property OnStartDrag;
|
||||
property OnSelect;
|
||||
property ParentBidiMode;
|
||||
property ParentColor;
|
||||
property ParentCtl3D;
|
||||
property ParentFont;
|
||||
@ -573,6 +579,7 @@ type
|
||||
published
|
||||
property Align;
|
||||
property Anchors;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property BorderStyle;
|
||||
property ClickOnSelChange;
|
||||
@ -612,6 +619,7 @@ type
|
||||
property OnSelectionChange;
|
||||
property OnShowHint;
|
||||
property OnStartDrag;
|
||||
property ParentBidiMode;
|
||||
property ParentShowHint;
|
||||
property ParentFont;
|
||||
property PopupMenu;
|
||||
@ -903,6 +911,7 @@ type
|
||||
property Alignment;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property BorderStyle;
|
||||
property Caption;
|
||||
@ -925,6 +934,7 @@ type
|
||||
property OnMouseUp;
|
||||
property OnResize;
|
||||
property OnStartDrag;
|
||||
property ParentBidiMode;
|
||||
property ParentFont;
|
||||
property ShowAccelChar;
|
||||
property TabOrder;
|
||||
@ -999,6 +1009,7 @@ type
|
||||
function ChildClassAllowed(ChildClass: TClass): boolean; override;
|
||||
function IsBorderSpacingInnerBorderStored: Boolean; override;
|
||||
property ParentColor default false;
|
||||
function UseRightToLeftAlignment: Boolean; override;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
procedure ExecuteDefaultAction; override;
|
||||
@ -1108,6 +1119,7 @@ type
|
||||
property AllowGrayed;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property Caption;
|
||||
property Checked;
|
||||
@ -1138,6 +1150,7 @@ type
|
||||
property ParentColor;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property ParentBidiMode;
|
||||
property PopupMenu;
|
||||
property ShowHint;
|
||||
property State;
|
||||
@ -1281,6 +1294,7 @@ type
|
||||
property AllowGrayed;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property Caption;
|
||||
property Checked;
|
||||
@ -1306,6 +1320,7 @@ type
|
||||
property OnMouseUp;
|
||||
property OnResize;
|
||||
property OnStartDrag;
|
||||
property ParentBidiMode;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
property PopupMenu;
|
||||
@ -1383,6 +1398,7 @@ type
|
||||
property Alignment;
|
||||
property Anchors;
|
||||
property AutoSize;
|
||||
property BidiMode;
|
||||
property BorderSpacing;
|
||||
property Caption;
|
||||
property Color;
|
||||
@ -1393,6 +1409,7 @@ type
|
||||
property FocusControl;
|
||||
property Font;
|
||||
property Layout;
|
||||
property ParentBidiMode;
|
||||
property ParentColor;
|
||||
property ParentFont;
|
||||
property ParentShowHint;
|
||||
@ -1488,3 +1505,4 @@ end.
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -70,6 +70,7 @@ type
|
||||
TWSMenuClass = class of TWSMenu;
|
||||
TWSMenu = class(TWSLCLComponent)
|
||||
class function CreateHandle(const AMenu: TMenu): HMENU; virtual;
|
||||
class procedure BiDiModeChanged(const AMenu: TMenu); virtual;
|
||||
end;
|
||||
|
||||
{ TWSMainMenu }
|
||||
@ -146,6 +147,10 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
class procedure TWSMenu.BiDiModeChanged(const AMenu: TMenu);
|
||||
begin
|
||||
end;
|
||||
|
||||
{ TWSPopupMenu }
|
||||
|
||||
class procedure TWSPopupMenu.Popup(const APopupMenu: TPopupMenu; const X, Y: integer);
|
||||
@ -163,4 +168,4 @@ initialization
|
||||
// RegisterWSComponent(TMainMenu, TWSMainMenu);
|
||||
// RegisterWSComponent(TPopupMenu, TWSPopupMenu);
|
||||
////////////////////////////////////////////////////
|
||||
end.
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user