diff --git a/components/mbColorLib/examples/fulldemo/main.lfm b/components/mbColorLib/examples/fulldemo/main.lfm index 4ce87495a..9d8b5f01c 100644 --- a/components/mbColorLib/examples/fulldemo/main.lfm +++ b/components/mbColorLib/examples/fulldemo/main.lfm @@ -1,10 +1,10 @@ object Form1: TForm1 Left = 447 - Height = 376 + Height = 397 Top = 197 Width = 539 Caption = 'mbColor Lib v2.0.1 Demo' - ClientHeight = 376 + ClientHeight = 397 ClientWidth = 539 Font.Color = clWindowText OnCreate = FormCreate @@ -38,14 +38,15 @@ object Form1: TForm1 ParentColor = False end object PageControl1: TPageControl - Left = 6 - Height = 363 + Left = 8 + Height = 384 Top = 6 Width = 403 - ActivePage = TabSheet3 + ActivePage = TabSheet10 Anchors = [akTop, akLeft, akRight, akBottom] - TabIndex = 2 + TabIndex = 10 TabOrder = 0 + OnChange = PageControl1Change OnMouseMove = PageControl1MouseMove object TabSheet1: TTabSheet Caption = 'HSLColorPicker' @@ -67,7 +68,7 @@ object Form1: TForm1 end object TabSheet2: TTabSheet Caption = 'HexaColorPicker' - ClientHeight = 335 + ClientHeight = 356 ClientWidth = 395 ImageIndex = 1 object Label4: TLabel @@ -75,14 +76,14 @@ object Form1: TForm1 AnchorSideTop.Side = asrCenter Left = 112 Height = 15 - Top = 314 + Top = 335 Width = 40 Caption = 'Marker:' ParentColor = False end object HexaColorPicker1: THexaColorPicker Left = 48 - Height = 303 + Height = 324 Top = 4 Width = 289 Anchors = [akTop, akLeft, akRight, akBottom] @@ -100,7 +101,7 @@ object Form1: TForm1 AnchorSideTop.Side = asrCenter Left = 4 Height = 19 - Top = 312 + Top = 333 Width = 83 Caption = 'SliderVisible' Checked = True @@ -111,7 +112,7 @@ object Form1: TForm1 object ComboBox1: TComboBox Left = 160 Height = 23 - Top = 310 + Top = 331 Width = 71 Anchors = [akLeft, akBottom] ItemHeight = 15 @@ -130,7 +131,7 @@ object Form1: TForm1 AnchorSideTop.Side = asrCenter Left = 256 Height = 20 - Top = 311 + Top = 332 Width = 101 Anchors = [akTop, akLeft, akBottom] Caption = 'NewArrowStyle' @@ -140,7 +141,7 @@ object Form1: TForm1 end object TabSheet3: TTabSheet Caption = 'mbColorPalette' - ClientHeight = 335 + ClientHeight = 356 ClientWidth = 395 ImageIndex = 2 object Label3: TLabel @@ -148,7 +149,7 @@ object Form1: TForm1 AnchorSideTop.Side = asrCenter Left = 6 Height = 15 - Top = 304 + Top = 325 Width = 24 Caption = 'Sort:' ParentColor = False @@ -158,7 +159,7 @@ object Form1: TForm1 AnchorSideTop.Side = asrCenter Left = 224 Height = 15 - Top = 304 + Top = 325 Width = 28 Caption = 'Style:' ParentColor = False @@ -168,7 +169,7 @@ object Form1: TForm1 AnchorSideTop.Side = asrCenter Left = 336 Height = 15 - Top = 304 + Top = 325 Width = 23 Caption = 'Size:' ParentColor = False @@ -176,7 +177,7 @@ object Form1: TForm1 object Button1: TButton Left = 6 Height = 25 - Top = 268 + Top = 289 Width = 107 Anchors = [akLeft, akBottom] Caption = 'Generate blue pal' @@ -186,7 +187,7 @@ object Form1: TForm1 object Button2: TButton Left = 120 Height = 25 - Top = 268 + Top = 289 Width = 135 Anchors = [akLeft, akBottom] Caption = 'Generate gradient pal' @@ -196,7 +197,7 @@ object Form1: TForm1 object Button4: TButton Left = 262 Height = 25 - Top = 268 + Top = 289 Width = 121 Anchors = [akLeft, akBottom] Caption = 'Load palette from file' @@ -205,21 +206,21 @@ object Form1: TForm1 end object ScrollBox1: TScrollBox Left = 6 - Height = 253 + Height = 274 Top = 8 Width = 385 - HorzScrollBar.Page = 385 - VertScrollBar.Page = 250 + HorzScrollBar.Page = 75 + VertScrollBar.Page = 50 Anchors = [akTop, akLeft, akRight, akBottom] BorderStyle = bsNone - ClientHeight = 253 + ClientHeight = 274 ClientWidth = 385 TabOrder = 3 object mbColorPalette1: TmbColorPalette Left = 0 - Height = 250 + Height = 271 Top = 0 - Width = 385 + Width = 378 Anchors = [akTop, akLeft, akRight, akBottom] Colors.Strings = ( 'clBlack' @@ -489,7 +490,7 @@ object Form1: TForm1 object ComboBox2: TComboBox Left = 34 Height = 23 - Top = 300 + Top = 321 Width = 87 Anchors = [akLeft, akBottom] ItemHeight = 15 @@ -506,7 +507,7 @@ object Form1: TForm1 object ComboBox3: TComboBox Left = 127 Height = 23 - Top = 300 + Top = 321 Width = 87 Anchors = [akLeft, akBottom] ItemHeight = 15 @@ -539,7 +540,7 @@ object Form1: TForm1 object ComboBox4: TComboBox Left = 256 Height = 23 - Top = 300 + Top = 321 Width = 71 Anchors = [akLeft, akBottom] ItemHeight = 15 @@ -556,7 +557,7 @@ object Form1: TForm1 object UpDown1: TUpDown Left = 364 Height = 23 - Top = 300 + Top = 321 Width = 15 Anchors = [akLeft, akBottom] Min = 0 @@ -569,14 +570,14 @@ object Form1: TForm1 end object TabSheet4: TTabSheet Caption = 'HSLRingPicker' - ClientHeight = 303 - ClientWidth = 391 + ClientHeight = 356 + ClientWidth = 395 ImageIndex = 3 object HSLRingPicker1: THSLRingPicker Left = 50 - Height = 289 + Height = 342 Top = 6 - Width = 293 + Width = 297 RingPickerHintFormat = 'Hue: %h' SLPickerHintFormat = 'S: %s L: %l'#13'Hex: %hex' Anchors = [akTop, akLeft, akRight, akBottom] @@ -587,14 +588,14 @@ object Form1: TForm1 end object TabSheet5: TTabSheet Caption = 'HSVColorPicker' - ClientHeight = 303 - ClientWidth = 391 + ClientHeight = 356 + ClientWidth = 395 ImageIndex = 4 object HSVColorPicker1: THSVColorPicker Left = 24 - Height = 289 + Height = 342 Top = 6 - Width = 328 + Width = 332 HintFormat = 'H: %h S: %s V: %v'#13'Hex: %hex' Anchors = [akTop, akLeft, akRight, akBottom] TabOrder = 0 @@ -602,8 +603,8 @@ object Form1: TForm1 OnChange = HSVColorPicker1Change end object VColorPicker2: TVColorPicker - Left = 360 - Height = 302 + Left = 364 + Height = 355 Top = 2 Width = 22 HintFormat = 'Value: %v (selected)' @@ -617,14 +618,14 @@ object Form1: TForm1 end object TabSheet6: TTabSheet Caption = 'SLHColorPicker' - ClientHeight = 329 - ClientWidth = 387 + ClientHeight = 356 + ClientWidth = 395 ImageIndex = 5 object SLHColorPicker1: TSLHColorPicker Left = 8 - Height = 317 + Height = 344 Top = 6 - Width = 377 + Width = 385 HPickerHintFormat = 'Hue: %h (selected)' SLPickerHintFormat = 'S: %s L: %l'#13'Hex: %hex' ParentShowHint = False @@ -636,12 +637,12 @@ object Form1: TForm1 end object TabSheet11: TTabSheet Caption = 'Lists && Trees' - ClientHeight = 335 + ClientHeight = 356 ClientWidth = 395 ImageIndex = 10 object mbColorList1: TmbColorList Left = 200 - Height = 278 + Height = 299 Top = 10 Width = 183 Anchors = [akTop, akLeft, akBottom] @@ -649,7 +650,7 @@ object Form1: TForm1 end object mbColorTree1: TmbColorTree Left = 8 - Height = 279 + Height = 300 Top = 10 Width = 184 InfoLabelText = 'Color Values:' @@ -662,7 +663,7 @@ object Form1: TForm1 object Button5: TButton Left = 128 Height = 25 - Top = 296 + Top = 317 Width = 137 Anchors = [akLeft, akBottom] Caption = 'Add colors from palette' @@ -672,7 +673,7 @@ object Form1: TForm1 end object TabSheet7: TTabSheet Caption = 'More' - ClientHeight = 335 + ClientHeight = 356 ClientWidth = 395 ImageIndex = 6 object Label9: TLabel @@ -694,19 +695,19 @@ object Form1: TForm1 ScreenHintFormat = 'RGB(%r, %g, %b)'#13'Hex: %h' ShowScreenHint = True end - object Button3: TButton + object OfficeColorDialogButton: TButton Left = 8 Height = 25 Top = 40 Width = 104 Caption = 'OfficeColorDialog' - OnClick = Button3Click + OnClick = OfficeColorDialogButtonClick TabOrder = 1 end object LColorPicker1: TLColorPicker Left = 34 Height = 25 - Top = 224 + Top = 245 Width = 347 HintFormat = 'Luminance: %l (selected)' SelectionIndicator = siRect @@ -719,7 +720,7 @@ object Form1: TForm1 object VColorPicker1: TVColorPicker Left = 34 Height = 21 - Top = 192 + Top = 213 Width = 347 HintFormat = 'Value: %v (selected)' ArrowPlacement = spBefore @@ -735,7 +736,7 @@ object Form1: TForm1 object HColorPicker1: THColorPicker Left = 34 Height = 61 - Top = 263 + Top = 284 Width = 347 HintFormat = 'Hue: %h (selected)' Increment = 5 @@ -748,7 +749,7 @@ object Form1: TForm1 end object SColorPicker1: TSColorPicker Left = 8 - Height = 254 + Height = 275 Top = 70 Width = 19 HintFormat = 'Saturation: %s (selected)' @@ -764,7 +765,7 @@ object Form1: TForm1 end object Memo1: TMemo Left = 128 - Height = 150 + Height = 171 Top = 26 Width = 253 Anchors = [akTop, akLeft, akRight, akBottom] @@ -811,7 +812,7 @@ object Form1: TForm1 end object TabSheet8: TTabSheet Caption = 'Other' - ClientHeight = 335 + ClientHeight = 356 ClientWidth = 395 ImageIndex = 7 object HSColorPicker1: THSColorPicker @@ -851,8 +852,8 @@ object Form1: TForm1 end object TabSheet9: TTabSheet Caption = 'Even more' - ClientHeight = 292 - ClientWidth = 372 + ClientHeight = 356 + ClientWidth = 395 ImageIndex = 8 object Label8: TLabel Left = 6 @@ -997,8 +998,8 @@ object Form1: TForm1 end object TabSheet10: TTabSheet Caption = 'Yet even more' - ClientHeight = 303 - ClientWidth = 391 + ClientHeight = 356 + ClientWidth = 395 ImageIndex = 9 object RAxisColorPicker1: TRAxisColorPicker Left = 10 @@ -1186,6 +1187,17 @@ object Form1: TForm1 State = cbChecked TabOrder = 7 end + object CbEnabled: TCheckBox + Left = 416 + Height = 19 + Top = 371 + Width = 62 + Caption = 'Enabled' + Checked = True + OnChange = CbEnabledChange + State = cbChecked + TabOrder = 8 + end object mbOfficeColorDialog1: TmbOfficeColorDialog UseHints = True left = 456 diff --git a/components/mbColorLib/examples/fulldemo/main.pas b/components/mbColorLib/examples/fulldemo/main.pas index ef5241c26..23caa5ca1 100644 --- a/components/mbColorLib/examples/fulldemo/main.pas +++ b/components/mbColorLib/examples/fulldemo/main.pas @@ -21,6 +21,7 @@ type TForm1 = class(TForm) CbShowHints: TCheckBox; + CbEnabled: TCheckBox; Label10: TLabel; Label11: TLabel; Label12: TLabel; @@ -52,7 +53,7 @@ type TabSheet8: TTabSheet; mbDeskPickerButton1: TmbDeskPickerButton; mbOfficeColorDialog1: TmbOfficeColorDialog; - Button3: TButton; + OfficeColorDialogButton: TButton; LColorPicker1: TLColorPicker; VColorPicker1: TVColorPicker; HColorPicker1: THColorPicker; @@ -104,7 +105,9 @@ type Memo1: TMemo; Label9: TLabel; CbSwatchStyle: TCheckBox; + procedure CbEnabledChange(Sender: TObject); procedure CbShowHintsChange(Sender: TObject); + procedure PageControl1Change(Sender: TObject); procedure PageControl1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure tb1Change(Sender: TObject); @@ -130,7 +133,7 @@ type procedure SLHColorPicker1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure mbDeskPickerButton1SelColorChange(Sender: TObject); - procedure Button3Click(Sender: TObject); + procedure OfficeColorDialogButtonClick(Sender: TObject); procedure HSColorPicker1Change(Sender: TObject); procedure HSColorPicker1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); @@ -265,13 +268,18 @@ sc.color := mbDeskPickerButton1.SelectedColor; uc.color := mbDeskPickerButton1.SelectedColor; end; +procedure TForm1.PageControl1Change(Sender: TObject); +begin + CbEnabledChange(nil); +end; + procedure TForm1.PageControl1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin uc.color := HSLColorpicker1.ColorUnderCursor; end; -procedure TForm1.Button3Click(Sender: TObject); +procedure TForm1.OfficeColorDialogButtonClick(Sender: TObject); begin if mbOfficeColorDialog1.Execute then sc.color := mbOfficeColorDialog1.SelectedColor; @@ -398,6 +406,65 @@ begin mbcolorlist1.UpdateColors; end; +procedure TForm1.CbEnabledChange(Sender: TObject); +begin + if PageControl1.ActivePage = Tabsheet1 then + HSLColorPicker1.Enabled := CbEnabled.Checked + else if PageControl1.ActivePage = Tabsheet2 then + HexaColorPicker1.Enabled := CbEnabled.Checked + else if PageControl1.ActivePage = Tabsheet3 then + mbColorPalette1.Enabled := CbEnabled.Checked + else if PageControl1.ActivePage = Tabsheet4 then + HSLRingPicker1.Enabled := CbEnabled.Checked + else if PageControl1.ActivePage = Tabsheet5 then + HSVColorPicker1.Enabled := CbEnabled.Checked + else if PageControl1.ActivePage = Tabsheet6 then + SLHColorPicker1.Enabled := CbEnabled.Checked + else if PageControl1.ActivePage = Tabsheet11 then + begin + mbColorList1.Enabled := CbEnabled.Checked; + mbColorTree1.Enabled := CbEnabled.Checked; + end + else if PageControl1.ActivePage = Tabsheet7 then + begin + mbDeskPickerButton1.Enabled := CbEnabled.Checked; + OfficeColorDialogButton.Enabled := CbEnabled.Checked; + LColorPicker1.Enabled := CbEnabled.Checked; + VColorPicker1.Enabled := CbEnabled.Checked; + HColorPicker1.Enabled := CbEnabled.Checked; + SColorPicker1.Enabled := CbEnabled.Checked; + end + else if PageControl1.ActivePage = Tabsheet8 then + begin + HSColorPicker1.Enabled := CbEnabled.Checked; + SLColorPicker1.Enabled := CbEnabled.Checked; + HRingPicker1.Enabled := CbEnabled.Checked; + end + else if PageControl1.ActivePage = Tabsheet9 then + begin + CColorPicker1.Enabled := CbEnabled.Checked; + MColorPicker1.Enabled := CbEnabled.Checked; + YColorPicker1.Enabled := CbEnabled.Checked; + KColorPicker1.Enabled := CbEnabled.Checked; + RColorPicker1.Enabled := CbEnabled.Checked; + BColorPicker1.Enabled := CbEnabled.Checked; + GColorPicker1.Enabled := CbEnabled.Checked; + KColorPicker2.Enabled := CbEnabled.Checked; + MColorPicker2.Enabled := CbEnabled.Checked; + CColorPicker2.Enabled := CbEnabled.Checked; + YColorPicker2.Enabled := CbEnabled.Checked; + end + else if PageControl1.ActivePage = Tabsheet10 then + begin + RAxisColorPicker1.Enabled := CbEnabled.Checked; + GAxisColorPicker1.Enabled := CbEnabled.Checked; + BAxisColorPicker1.Enabled := CbEnabled.Checked; + CIELColorPicker1.Enabled := CbEnabled.Checked; + CIEAColorPicker1.Enabled := CbEnabled.Checked; + CIEBColorPicker1.Enabled := CbEnabled.Checked; + end; +end; + procedure TForm1.CbSwatchStyleClick(Sender: TObject); begin sc.swatchstyle := CbSwatchStyle.Checked; diff --git a/components/mbColorLib/mbColorPalette.pas b/components/mbColorLib/mbColorPalette.pas index c2fe7518b..f9915e3eb 100644 --- a/components/mbColorLib/mbColorPalette.pas +++ b/components/mbColorLib/mbColorPalette.pas @@ -74,28 +74,29 @@ type procedure DrawCell(ACanvas: TCanvas; AColor: string); procedure DrawCellBack(ACanvas: TCanvas; R: TRect; AIndex: integer); procedure ColorsChange(Sender: TObject); - procedure Click; override; procedure Resize; override; procedure SelectCell(i: integer); // procedure CreateWnd; override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; - procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure MouseEnter; override; + procedure MouseLeave; override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; {$IFDEF DELPHI} - procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; - procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; +// procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; +// procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; procedure CNKeyDown(var Message: TWMKeyDown); message CN_KEYDOWN; procedure CMGotFocus(var Message: TCMGotFocus); message CM_ENTER; procedure CMLostFocus(var Message: TCMLostFocus); message CM_EXIT; - procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED; +// procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED; procedure CMHintShow(var Message: TMessage); message CM_HINTSHOW; {$ELSE} - procedure CMMouseEnter(var Message: TLMessage); message CM_MOUSEENTER; - procedure CMMouseLeave(var Message: TLMessage); message CM_MOUSELEAVE; +// procedure CMMouseEnter(var Message: TLMessage); message CM_MOUSEENTER; + // procedure CMMouseLeave(var Message: TLMessage); message CM_MOUSELEAVE; procedure CNKeyDown(var Message: TLMKeyDown); message CN_KEYDOWN; procedure CMGotFocus(var Message: TLMessage); message CM_ENTER; procedure CMLostFocus(var Message: TLMessage); message CM_EXIT; - procedure CMEnabledChanged(var Message: TLMessage); message CM_ENABLEDCHANGED; +// procedure CMEnabledChanged(var Message: TLMessage); message CM_ENABLEDCHANGED; procedure CMHintShow(var Message: TLMessage); message CM_HINTSHOW; {$ENDIF} @@ -689,10 +690,10 @@ end; procedure TmbColorPalette.Resize; begin inherited; - CalcAutoHeight; // wp: will cause a ChangedBounds endless loop + CalcAutoHeight; Invalidate; end; - + (* procedure TmbColorPalette.CMMouseEnter( var Message: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF} ); begin @@ -711,6 +712,24 @@ begin Invalidate; inherited; end; +*) + +procedure TmbColorPalette.MouseEnter; +begin + FMouseOver := true; + FMouseLoc := mlOver; + Invalidate; + inherited; +end; + +procedure TmbColorPalette.MouseLeave; +begin + FMouseOver := false; + FMouseLoc := mlNone; + FIndex := -1; + Invalidate; + inherited; +end; procedure TmbColorPalette.MouseMove(Shift: TShiftState; X, Y: Integer); var @@ -744,11 +763,6 @@ begin inherited; end; -procedure TmbColorPalette.Click; -begin - inherited; -end; - procedure TmbColorPalette.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var DontCheck: boolean; @@ -790,14 +804,14 @@ begin FMouseLoc := mlNone; Invalidate; end; - + (* procedure TmbColorPalette.CMEnabledChanged( var Message: {$IFDEF DELPHI}TMessage{$ELSE}TLMessage{$ENDIF} ); begin inherited; Invalidate; end; - + *) procedure TmbColorPalette.SelectCell(i: integer); begin if i < FColors.Count - 1 then