You've already forked lazarus-ccr
tvplanit: Add new property CaptionStyle (lowercase or uppercase) to TVpContactButtonBar.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6482 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -413,6 +413,7 @@ object MainForm: TMainForm
|
|||||||
BorderWidth = 3
|
BorderWidth = 3
|
||||||
ButtonHeight = 20
|
ButtonHeight = 20
|
||||||
ButtonWidth = 36
|
ButtonWidth = 36
|
||||||
|
CaptionStyle = csUppercase
|
||||||
ContactGrid = VpContactGrid1
|
ContactGrid = VpContactGrid1
|
||||||
DrawingStyle = dsNoBorder
|
DrawingStyle = dsNoBorder
|
||||||
RadioStyle = True
|
RadioStyle = True
|
||||||
|
@@ -50,7 +50,8 @@ const
|
|||||||
VP_MIN_BUTTONS = 2;
|
VP_MIN_BUTTONS = 2;
|
||||||
VP_LETTERS_IN_ALPHABET = 26;
|
VP_LETTERS_IN_ALPHABET = 26;
|
||||||
VP_MAX_BUTTONS = VP_LETTERS_IN_ALPHABET + 1;
|
VP_MAX_BUTTONS = VP_LETTERS_IN_ALPHABET + 1;
|
||||||
VP_LETTER_A = Ord('a');
|
VP_LETTER_A_UC = Ord('A');
|
||||||
|
VP_LETTER_A_LC = Ord('a');
|
||||||
|
|
||||||
type
|
type
|
||||||
TVpButtonRec = packed record
|
TVpButtonRec = packed record
|
||||||
@@ -60,6 +61,8 @@ type
|
|||||||
|
|
||||||
TVpButtonArray = array[0..VP_MAX_BUTTONS - 1] of TVpButtonRec;
|
TVpButtonArray = array[0..VP_MAX_BUTTONS - 1] of TVpButtonRec;
|
||||||
|
|
||||||
|
TVpButtonCaptionStyle = (csLowercase, csUppercase);
|
||||||
|
|
||||||
TVpButtonBarOrientation = (baHorizontal, baVertical);
|
TVpButtonBarOrientation = (baHorizontal, baVertical);
|
||||||
|
|
||||||
TVpButtonBarClickEvent = procedure(Sender: TObject; ButtonIndex: Integer;
|
TVpButtonBarClickEvent = procedure(Sender: TObject; ButtonIndex: Integer;
|
||||||
@@ -75,6 +78,7 @@ type
|
|||||||
FButtonHeight: Integer;
|
FButtonHeight: Integer;
|
||||||
FButtonsArray: TVpButtonArray;
|
FButtonsArray: TVpButtonArray;
|
||||||
FButtonWidth: Integer;
|
FButtonWidth: Integer;
|
||||||
|
FCaptionStyle: TVpButtonCaptionStyle;
|
||||||
FContactGrid: TVpContactGrid;
|
FContactGrid: TVpContactGrid;
|
||||||
FDrawingStyle: TVpDrawingStyle;
|
FDrawingStyle: TVpDrawingStyle;
|
||||||
FOnButtonClick: TVpButtonBarClickEvent;
|
FOnButtonClick: TVpButtonBarClickEvent;
|
||||||
@@ -95,6 +99,7 @@ type
|
|||||||
procedure SetButtonColor(const Value: TColor);
|
procedure SetButtonColor(const Value: TColor);
|
||||||
procedure SetButtonHeight(const Value: Integer);
|
procedure SetButtonHeight(const Value: Integer);
|
||||||
procedure SetButtonWidth(const Value: Integer);
|
procedure SetButtonWidth(const Value: Integer);
|
||||||
|
procedure SetCaptionStyle(const Value: TVpButtonCaptionStyle);
|
||||||
procedure SetContactGrid(Value: TVpContactGrid);
|
procedure SetContactGrid(Value: TVpContactGrid);
|
||||||
procedure SetDrawingStyle(const Value: TVpDrawingStyle);
|
procedure SetDrawingStyle(const Value: TVpDrawingStyle);
|
||||||
procedure SetShowNumberButton(const Value: Boolean);
|
procedure SetShowNumberButton(const Value: Boolean);
|
||||||
@@ -123,6 +128,8 @@ type
|
|||||||
read FButtonHeight write SetButtonHeight default 18;
|
read FButtonHeight write SetButtonHeight default 18;
|
||||||
property ButtonWidth: Integer
|
property ButtonWidth: Integer
|
||||||
read FButtonWidth write SetButtonWidth default 34;
|
read FButtonWidth write SetButtonWidth default 34;
|
||||||
|
property CaptionStyle: TVpButtonCaptionStyle
|
||||||
|
read FCaptionStyle write SetCaptionStyle default csLowerCase;
|
||||||
property ContactGrid: TVpContactGrid
|
property ContactGrid: TVpContactGrid
|
||||||
read FContactGrid write SetContactGrid;
|
read FContactGrid write SetContactGrid;
|
||||||
property DrawingStyle: TVpDrawingStyle
|
property DrawingStyle: TVpDrawingStyle
|
||||||
@@ -201,6 +208,7 @@ begin
|
|||||||
FButtonColor := clBtnFace;
|
FButtonColor := clBtnFace;
|
||||||
FButtonHeight := 18;
|
FButtonHeight := 18;
|
||||||
FButtonWidth := 34;
|
FButtonWidth := 34;
|
||||||
|
FCaptionStyle := csLowercase;
|
||||||
FDrawingStyle := ds3d;
|
FDrawingStyle := ds3d;
|
||||||
FShowNumberButton := True;
|
FShowNumberButton := True;
|
||||||
end;
|
end;
|
||||||
@@ -225,6 +233,7 @@ var
|
|||||||
btnHeight: Integer;
|
btnHeight: Integer;
|
||||||
btnWidth: Integer;
|
btnWidth: Integer;
|
||||||
brdrWidth: Integer;
|
brdrWidth: Integer;
|
||||||
|
VP_Letter_A: integer;
|
||||||
begin
|
begin
|
||||||
I := 0;
|
I := 0;
|
||||||
|
|
||||||
@@ -236,6 +245,11 @@ begin
|
|||||||
MinButtons := VP_MIN_BUTTONS;
|
MinButtons := VP_MIN_BUTTONS;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
case FCaptionStyle of
|
||||||
|
csUppercase: VP_Letter_A := VP_LETTER_A_UC;
|
||||||
|
csLowercase: VP_Letter_A := VP_LETTER_A_LC;
|
||||||
|
end;
|
||||||
|
|
||||||
btnHeight := ScaleY(FButtonHeight, DesignTimeDPI);
|
btnHeight := ScaleY(FButtonHeight, DesignTimeDPI);
|
||||||
btnWidth := ScaleX(FButtonWidth, DesignTimeDPI);
|
btnWidth := ScaleX(FButtonWidth, DesignTimeDPI);
|
||||||
brdrWidth := ScaleX(FBorderWidth, DesignTimeDPI);
|
brdrWidth := ScaleX(FBorderWidth, DesignTimeDPI);
|
||||||
@@ -276,8 +290,8 @@ begin
|
|||||||
ButtonLetters := VP_LETTERS_IN_ALPHABET / FButtonCount;
|
ButtonLetters := VP_LETTERS_IN_ALPHABET / FButtonCount;
|
||||||
|
|
||||||
for i := 0 to FButtonCount - Offset - 1 do begin
|
for i := 0 to FButtonCount - Offset - 1 do begin
|
||||||
StartLetter := Chr(Round(VP_LETTER_A + ButtonLetters * I));
|
StartLetter := Chr(round(VP_Letter_A + ButtonLetters * I));
|
||||||
EndLetter := Chr(Round(VP_LETTER_A + ButtonLetters * (I + 1)) - 1);
|
EndLetter := Chr(round(VP_Letter_A + ButtonLetters * (I + 1) - 1));
|
||||||
|
|
||||||
if Ord(EndLetter) = Ord(StartLetter) then
|
if Ord(EndLetter) = Ord(StartLetter) then
|
||||||
ButtonCaption := StartLetter
|
ButtonCaption := StartLetter
|
||||||
@@ -457,6 +471,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
|
procedure TVpContactButtonBar.SetCaptionStyle(const Value: TVpButtonCaptionStyle);
|
||||||
|
begin
|
||||||
|
if (FCaptionStyle <> Value) then begin
|
||||||
|
FCaptionStyle := Value;
|
||||||
|
CreateButtons;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TVpContactButtonBar.SetContactGrid(Value: TVpContactGrid);
|
procedure TVpContactButtonBar.SetContactGrid(Value: TVpContactGrid);
|
||||||
begin
|
begin
|
||||||
if (FContactGrid <> Value) then begin
|
if (FContactGrid <> Value) then begin
|
||||||
@@ -467,7 +490,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{=====}
|
|
||||||
|
|
||||||
procedure TVpContactButtonBar.bbPopulateSearchString;
|
procedure TVpContactButtonBar.bbPopulateSearchString;
|
||||||
var
|
var
|
||||||
|
Reference in New Issue
Block a user