From d2ef0b3ccac21b156ce6b38cc329a9d2e1b109f3 Mon Sep 17 00:00:00 2001 From: macpgmr Date: Sat, 22 Jan 2011 23:42:18 +0000 Subject: [PATCH] Improved TOvcLabel's Style Manager property editor a little; added support for Cmd+click to TOvcVLB for Carbon. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1454 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/orpheus/ovcclrcb.pas | 58 ++++++++++++++++++++++++++------- components/orpheus/ovccmbx.pas | 2 +- components/orpheus/ovcvlb.pas | 4 +++ 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/components/orpheus/ovcclrcb.pas b/components/orpheus/ovcclrcb.pas index eca176945..ee86f3b3d 100644 --- a/components/orpheus/ovcclrcb.pas +++ b/components/orpheus/ovcclrcb.pas @@ -197,18 +197,11 @@ begin Style := ocsDropDownList; FShowColorNames := True; -end; - -destructor TOvcCustomColorComboBox.Destroy; -begin - inherited; -end; - -{ - modified} -procedure TOvcCustomColorComboBox.CreateWnd; -begin - inherited CreateWnd; - + +// On Carbon, SetSelectedColor gets called before Items is populated +// in CreateWnd below, so moved code to here. +// Note: Isn't CreateWnd an odd place to initialize a control? +{$IFDEF LCL} Text := ''; Items.Clear; Items.Add(GetOrphStr(SCColorBlack)); @@ -235,6 +228,47 @@ begin Items.Add(GetOrphStr(SCColorCream)); ItemIndex := 0; +{$ENDIF} +end; + +destructor TOvcCustomColorComboBox.Destroy; +begin + inherited; +end; + +{ - modified} +procedure TOvcCustomColorComboBox.CreateWnd; +begin + inherited CreateWnd; + +{$IFNDEF LCL} //See note above. + Text := ''; + Items.Clear; + Items.Add(GetOrphStr(SCColorBlack)); + Items.Add(GetOrphStr(SCColorMaroon)); + Items.Add(GetOrphStr(SCColorGreen)); + Items.Add(GetOrphStr(SCColorOlive)); + Items.Add(GetOrphStr(SCColorNavy)); + Items.Add(GetOrphStr(SCColorPurple)); + Items.Add(GetOrphStr(SCColorTeal)); + Items.Add(GetOrphStr(SCColorGray)); + Items.Add(GetOrphStr(SCColorSilver)); + Items.Add(GetOrphStr(SCColorRed)); + Items.Add(GetOrphStr(SCColorLime)); + Items.Add(GetOrphStr(SCColorYellow)); + Items.Add(GetOrphStr(SCColorBlue)); + Items.Add(GetOrphStr(SCColorFuchsia)); + Items.Add(GetOrphStr(SCColorAqua)); + Items.Add(GetOrphStr(SCColorLightGray)); + Items.Add(GetOrphStr(SCColorMediumGray)); + Items.Add(GetOrphStr(SCColorDarkGray)); + Items.Add(GetOrphStr(SCColorWhite)); + Items.Add(GetOrphStr(SCColorMoneyGreen)); + Items.Add(GetOrphStr(SCColorSkyBlue)); + Items.Add(GetOrphStr(SCColorCream)); + + ItemIndex := 0; +{$ENDIF} end; procedure TOvcCustomColorComboBox.DrawItem(Index : Integer; Rect : TRect; diff --git a/components/orpheus/ovccmbx.pas b/components/orpheus/ovccmbx.pas index cf2c6f83b..7e693ebfc 100644 --- a/components/orpheus/ovccmbx.pas +++ b/components/orpheus/ovccmbx.pas @@ -1524,7 +1524,7 @@ begin with PMStruct^ do begin ItemWidth := ClientWidth; IHeight := ItemHeight; - MeasureItem(ItemID, IHeight); + MeasureItem(LongInt(ItemID), IHeight); // LCL: UINT ItemID can be out of range on Win. ItemHeight := IHeight; end; end; diff --git a/components/orpheus/ovcvlb.pas b/components/orpheus/ovcvlb.pas index 12db33e78..e6bbb33e7 100644 --- a/components/orpheus/ovcvlb.pas +++ b/components/orpheus/ovcvlb.pas @@ -2395,7 +2395,11 @@ begin {get the key state} if FMultiSelect then begin +{$IFNDEF LCLCarbon} CtrlKeyDown := GetKeyState(VK_CONTROL) and $8000 <> 0; +{$ELSE} {Cmd+click used on Mac for non-contiguous selection; see it as VK_LWIN} + CtrlKeyDown := GetKeyState(VK_LWIN) and $8000 <> 0; +{$ENDIF} ShiftKeyDown := GetKeyState(VK_SHIFT) and $8000 <> 0; end else begin CtrlKeyDown := False;