From b63e712b193dae55671c152323d7ce1a2d3e4348 Mon Sep 17 00:00:00 2001 From: micha Date: Fri, 7 Jan 2005 20:51:11 +0000 Subject: [PATCH] swap TCustomStaticText and TCustomLabel git-svn-id: trunk@6500 - --- lcl/extctrls.pp | 7 +- lcl/include/customlabel.inc | 329 +++++++++++----------- lcl/include/customstatictext.inc | 350 +++++++++++++----------- lcl/interfaces/gtk/gtkobject.inc | 11 +- lcl/interfaces/gtk/gtkwscontrols.pp | 14 +- lcl/interfaces/gtk/gtkwsextctrls.pp | 9 - lcl/interfaces/gtk/gtkwsstdctrls.pp | 59 ++-- lcl/interfaces/win32/win32wsextctrls.pp | 9 - lcl/interfaces/win32/win32wsstdctrls.pp | 73 ++--- lcl/lcltype.pp | 9 +- lcl/stdctrls.pp | 63 +++-- lcl/widgetset/wsdbctrls.pp | 6 - lcl/widgetset/wsextctrls.pp | 6 - lcl/widgetset/wsstdctrls.pp | 42 +-- 14 files changed, 462 insertions(+), 525 deletions(-) diff --git a/lcl/extctrls.pp b/lcl/extctrls.pp index ea4ce8993f..62184e44af 100644 --- a/lcl/extctrls.pp +++ b/lcl/extctrls.pp @@ -779,8 +779,8 @@ type property OnMouseDown; property OnMouseMove; property OnMouseUp; - property OnEnter; - property OnExit; + //property OnEnter; + //property OnExit; end; @@ -984,6 +984,9 @@ end. { $Log$ + Revision 1.126 2005/01/07 20:51:10 micha + swap TCustomStaticText and TCustomLabel + Revision 1.125 2004/12/27 19:40:59 mattias published BorderSpacing for many controls diff --git a/lcl/include/customlabel.inc b/lcl/include/customlabel.inc index ddfe3afb8f..3068dfa995 100644 --- a/lcl/include/customlabel.inc +++ b/lcl/include/customlabel.inc @@ -1,7 +1,7 @@ {%MainUnit ../stdctrls.pp} {****************************************************************************** - TCustomLabel + TCustomLabel ****************************************************************************** ***************************************************************************** @@ -16,87 +16,107 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * * ***************************************************************************** + + TODO: + + - Enable Tabbing/Focusing to focus FocusControl + - Enable Escaped '&' Shortcut to focus FocusControl + - Compare/Match AutoSize to Delphi/Kylix's + - ?? Check For Full Delphi/Kylix Compatibility + } - -{------------------------------------------------------------------------------ - Method: TCustomLabel.Create - Params: AOwner: the owner of the class - Returns: Nothing - - Constructor for the class. - ------------------------------------------------------------------------------} -constructor TCustomLabel.Create(AOwner: TComponent); +Procedure TCustomLabel.DoAutoSize; +var + R : TRect; + DC : hDC; begin - inherited Create(AOwner); - fCompStyle := csLabel; - FLayout := tlTop; - fAlignment := taLeftJustify; - FShowAccelChar:= true; - ControlStyle := ControlStyle + [csOpaque, csReplicatable]; - SetInitialBounds(0, 0, 65, 17); + If AutoSizing or not AutoSize then + Exit; + if (Parent = nil) or (not Parent.HandleAllocated) or ([csLoading,csDestroying]*ComponentState<>[]) then + exit; + AutoSizing := True; + DC := GetDC(Parent.Handle); + Try + R := Rect(0,0, Width, Height); + SelectObject(DC, Font.Handle); + DrawText(DC, PChar(Caption), Length(Caption), R, + DT_CalcRect or DT_NoPrefix or DT_WordBreak); + + Width := R.Right - R.Left; + Height := R.Bottom - R.Top; + Finally + ReleaseDC(Parent.Handle, DC); + AutoSizing := False; + end; end; -{------------------------------------------------------------------------------ - Method: TCustomLabel.GetLabelText - Params: None - Returns: Nothing - - ------------------------------------------------------------------------------} -function TCustomLabel.GetLabelText: String; +Procedure TCustomLabel.SetAlignment(Value : TAlignment); begin - Result := Caption; + If FAlignment <> Value then begin + FAlignment := Value; + Invalidate; + end; end; -procedure TCustomLabel.RealSetText(const AValue: TCaption); -begin - if Text=AValue then exit; - inherited RealSetText(AValue); - InvalidatePreferredSize; - {$IFDEF EnablePreferredSize} - DoAutoSize; - {$ENDIF} -end; - -{------------------------------------------------------------------------------ - procedure TCustomLabel.Notification(AComponent: TComponent; - Operation: TOperation); - ------------------------------------------------------------------------------} -procedure TCustomLabel.Notification(AComponent: TComponent; Operation: TOperation); +procedure TCustomLabel.Notification(AComponent : TComponent; Operation : TOperation); begin inherited Notification(AComponent, Operation); if (AComponent = FFocusControl) and (Operation = opRemove) then FFocusControl:= nil; end; -{------------------------------------------------------------------------------ - Method: TCustomLabel.SetAlignment - Params: Value - new proterty value - Returns: Nothing - - ------------------------------------------------------------------------------} -procedure TCustomLabel.SetAlignment(Value: TAlignment); +procedure TCustomLabel.SetFocusControl(Value : TWinControl); begin - if fAlignment <> value then begin - fAlignment:= value; - if HandleAllocated then - TWSCustomLabelClass(WidgetSetClass).SetAlignment(Self, Value); + if Value <> FFocusControl then begin + FFocusControl:= Value; + if Value <> nil then Value.FreeNotification(Self); end; end; -{------------------------------------------------------------------------------ - Method: TCustomLabel.SetFocusControl - Params: Val - new property value - Returns: Nothing - - ------------------------------------------------------------------------------} -procedure TCustomLabel.SetFocusControl(Val: TWinControl); +procedure TCustomLabel.WMActivate(var Message: TLMActivate); begin - if Val <> FFocusControl then begin - FFocusControl:= Val; - if Val <> nil then Val.FreeNotification(Self); + if (FFocusControl <> nil) and (FFocusControl.CanFocus) then + FFocusControl.SetFocus; +end; + +Function TCustomLabel.GetAlignment : TAlignment; +begin + Result := FAlignment; +end; + +Procedure TCustomLabel.SetShowAccelChar(Value : Boolean); +begin + If FShowAccelChar <> Value then begin + FShowAccelChar := Value; + Invalidate; end; end; +procedure TCustomLabel.CMTextChanged(var Message: TLMSetText); +begin + Invalidate; +end; + +Function TCustomLabel.GetShowAccelChar : Boolean; +begin + Result := FShowAccelChar; +end; + +function TCustomLabel.CanTab: boolean; +begin + Result:=false; +end; + +constructor TCustomLabel.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Font.OnChange := @FontChange; + ControlStyle := [csSetCaption, csOpaque, csClickEvents, csDoubleClicks, + csReplicatable]; + Width := 65; + Height := 17; +end; + {------------------------------------------------------------------------------ Method: TCustomLabel.SetLayout Params: None @@ -107,51 +127,10 @@ procedure TCustomLabel.SetLayout(Value: TTextLayout); begin if FLayout <> Value then begin FLayout:= Value; - if HandleAllocated then - TWSCustomLabelClass(WidgetSetClass).SetLayout(Self, Value); + Invalidate; end; end; -{------------------------------------------------------------------------------ - Method: TCustomLabel.SetShowAccelChar - Params: Val - new property value - Returns: Nothing - - ------------------------------------------------------------------------------} -procedure TCustomLabel.SetShowAccelChar(Val: boolean); -begin - if Val <> FShowAccelChar then begin - FShowAccelChar:= Val; - if HandleAllocated then - TWSWinControlClass(WidgetSetClass).SetText(Self,Caption); - end; -end; - -{$IFNDEF EnablePreferredSize} -procedure TCustomLabel.DoAutoSize; -var - R: TRect; - DC: hDC; -begin - If AutoSizing or (not AutoSize) or (Caption='') then - Exit; - if (not HandleAllocated) or ([csLoading,csDestroying]*ComponentState<>[]) then - exit; - AutoSizing := True; - DC := GetDC(Handle); - Try - R := Rect(0,0, Width, Height); - DrawText(DC, PChar(Caption + 'W'), Length(Caption) + 1, R, - DT_CalcRect or DT_NoPrefix or DT_Internal); - Width := R.Right; - Height := R.Bottom; - Finally - ReleaseDC(Handle, DC); - AutoSizing := False; - end; -end; -{$ENDIF} - {------------------------------------------------------------------------------ Method: TCustomLabel.SetWordWrap Params: None @@ -162,96 +141,100 @@ procedure TCustomLabel.SetWordWrap(Value: Boolean); begin if fWordWrap <> value then begin fWordWrap:= value; - if HandleAllocated then - TWSCustomLabelClass(WidgetSetClass).SetWordWrap(Self, Value); + Invalidate; end; end; -{------------------------------------------------------------------------------ - Method: TCustomLabel.WMActivate - Params: Message: Activation message - Returns: Nothing - - Received when the label has a registered activation shortcut for focuscontrol. - ------------------------------------------------------------------------------} -procedure TCustomLabel.WMActivate(var Message: TLMActivate); +Procedure TCustomLabel.Paint; +var + TR : TTextStyle; + R : TRect; begin - if (FFocusControl <> nil) and (FFocusControl.CanFocus) then - FFocusControl.SetFocus; + R := Rect(0,0,Width,Height); + With Canvas do begin + Color := Self.Color; + Font := Self.Font; + if Color<>clNone then + FillRect(R); +{ + If BorderStyle <> sbsNone then begin + InflateRect(R,-2,-2); + Pen.Style := psSolid; + If BorderStyle = sbsSunken then + Pen.Color := clBtnShadow + else + Pen.Color := clBtnHighlight; + MoveTo(0, 0); + LineTo(Width - 1,0); + MoveTo(0, 0); + LineTo(0,Height - 1); + If BorderStyle = sbsSunken then + Pen.Color := clBtnHighlight + else + Pen.Color := clBtnShadow; + MoveTo(0,Height - 1); + LineTo(Width - 1,Height - 1); + MoveTo(Width - 1, 0); + LineTo(Width - 1,Height); + end; +} + FillChar(TR,SizeOf(TR),0); + With TR do begin + Alignment := Self.Alignment; + WordBreak := True; + Clipping := True; + ShowPrefix := ShowAccelChar; + SystemFont:=false; + end; + TextRect(R, R.Left, R.Top, Caption, TR); + end; end; -// included by stdctrls.pp +Procedure TCustomLabel.FontChange(Sender : TObject); +begin + If Caption <> '' then + Invalidate; +end; -{ ============================================================================= + // included by stdctrls.pp + +{ $Log$ - Revision 1.19 2004/11/03 14:18:35 mattias - implemented preferred size for controls for theme depending AutoSizing + Revision 1.20 2005/01/07 20:51:11 micha + swap TCustomStaticText and TCustomLabel - Revision 1.18 2004/09/25 15:05:38 mattias - implemented Rename Identifier + Revision 1.9 2004/12/31 11:27:35 mattias + skip FillRect in TStaticText.Paint when Color=clNone - Revision 1.17 2004/09/22 14:50:18 micha - convert LM_SETPROPERTIES message for tcustomlabel to interface methods + Revision 1.8 2004/09/24 13:45:32 mattias + fixed TCanvas.TextRect Delphi compatible Rect and added TBarChart from Michael VC - Revision 1.16 2004/09/10 09:43:12 micha - convert LM_SETLABEL message to interface methods + Revision 1.7 2004/08/04 09:57:17 mattias + TStaticText.CanTab=false - Revision 1.15 2004/04/20 23:39:01 marc - * Fixed setting of TWincontrol.Text during load + Revision 1.6 2004/05/21 09:03:55 micha + implement new borderstyle + - centralize to twincontrol (protected) + - public expose at tcustomcontrol to let interface access it - Revision 1.14 2004/04/10 17:58:57 mattias + Revision 1.5 2004/04/10 17:58:57 mattias implemented mainunit hints for include files - Revision 1.13 2004/03/08 22:36:01 mattias - added TWinControl.ParentFormInitializeWnd - - Revision 1.12 2004/03/07 09:37:20 mattias + Revision 1.4 2004/03/07 09:37:20 mattias added workaround for AutoSize in TCustomLabel - Revision 1.11 2004/02/23 08:19:04 micha - revert intf split + Revision 1.3 2004/01/03 23:14:59 mattias + default font can now change height and fixed gtk crash - Revision 1.9 2003/02/28 19:10:25 mattias - added new ... dialog + Revision 1.2 2002/10/23 20:47:26 lazarus + AJ: Started Form Scrolling + Started StaticText FocusControl + Fixed Misc Dialog Problems + Added TApplication.Title - Revision 1.8 2002/10/16 17:06:33 lazarus - MG: fixed handle allocating in TLabel - - Revision 1.7 2002/10/03 00:08:50 lazarus - AJ: TCustomLabel Autosize, TCustomCheckbox '&' shortcuts started - - Revision 1.6 2002/09/03 20:02:01 lazarus - Intermediate UI patch to show a bug. - - Revision 1.5 2002/09/03 11:32:49 lazarus - - Added shortcut keys to labels - Support for alphabetically sorting the properties - Standardize message and add shortcuts ala Kylix - Published BorderStyle, unpublished BorderWidth - ShowAccelChar and FocusControl - ShowAccelChar and FocusControl for TLabel, escaped ampersands now work. - - Revision 1.4 2002/08/30 10:06:07 lazarus - Fixed alignment of multiline TLabel. - Simplified and prettified MessageBoxen. - - Revision 1.3 2002/05/10 06:05:52 lazarus - MG: changed license to LGPL - - Revision 1.2 2002/04/18 08:09:03 lazarus - MG: added include comments - - Revision 1.1 2000/07/13 10:28:25 michael - + Initial import - - Revision 1.3 2000/05/30 22:28:41 lazarus - MWE: - Applied patches from Vincent Snijders: - + Added GetWindowRect - * Fixed horz label alignment - + Added vert label alignment + Revision 1.1 2002/10/21 15:51:27 lazarus + AJ: moved TCustomStaticText code to include/customstatictext.inc } diff --git a/lcl/include/customstatictext.inc b/lcl/include/customstatictext.inc index 6d2b1dd587..9085e3fbe0 100644 --- a/lcl/include/customstatictext.inc +++ b/lcl/include/customstatictext.inc @@ -1,7 +1,7 @@ {%MainUnit ../stdctrls.pp} {****************************************************************************** - TCustomStaticText + TCustomStaticText ****************************************************************************** ***************************************************************************** @@ -16,21 +16,124 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * * ***************************************************************************** - - TODO: - - - Enable Tabbing/Focusing to focus FocusControl - - Enable Escaped '&' Shortcut to focus FocusControl - - Compare/Match AutoSize to Delphi/Kylix's - - ?? Check For Full Delphi/Kylix Compatibility - } -Procedure TCustomStaticText.DoAutoSize; -var - R : TRect; - DC : hDC; + +{------------------------------------------------------------------------------ + Method: TCustomStaticText.Create + Params: AOwner: the owner of the class + Returns: Nothing + + Constructor for the class. + ------------------------------------------------------------------------------} +constructor TCustomStaticText.Create(AOwner: TComponent); begin - If AutoSizing or not AutoSize then + inherited Create(AOwner); + fCompStyle := csStaticText; + FLayout := tlTop; + fAlignment := taLeftJustify; + FShowAccelChar:= true; + ControlStyle := ControlStyle + [csOpaque, csReplicatable]; + SetInitialBounds(0, 0, 65, 17); +end; + +{------------------------------------------------------------------------------ + Method: TCustomStaticText.GetLabelText + Params: None + Returns: Nothing + + ------------------------------------------------------------------------------} +function TCustomStaticText.GetLabelText: String; +begin + Result := Caption; +end; + +procedure TCustomStaticText.RealSetText(const AValue: TCaption); +begin + if Text=AValue then exit; + inherited RealSetText(AValue); + InvalidatePreferredSize; + {$IFDEF EnablePreferredSize} + DoAutoSize; + {$ENDIF} +end; + +{------------------------------------------------------------------------------ + procedure TCustomStaticText.Notification(AComponent: TComponent; + Operation: TOperation); + ------------------------------------------------------------------------------} +procedure TCustomStaticText.Notification(AComponent: TComponent; Operation: TOperation); +begin + inherited Notification(AComponent, Operation); + if (AComponent = FFocusControl) and (Operation = opRemove) then + FFocusControl:= nil; +end; + +{------------------------------------------------------------------------------ + Method: TCustomStaticText.SetAlignment + Params: Value - new proterty value + Returns: Nothing + + ------------------------------------------------------------------------------} +procedure TCustomStaticText.SetAlignment(Value: TAlignment); +begin + if fAlignment <> value then begin + fAlignment:= value; + if HandleAllocated then + TWSCustomStaticTextClass(WidgetSetClass).SetAlignment(Self, Value); + end; +end; + +{------------------------------------------------------------------------------ + Method: TCustomStaticText.SetFocusControl + Params: Val - new property value + Returns: Nothing + + ------------------------------------------------------------------------------} +procedure TCustomStaticText.SetFocusControl(Val: TWinControl); +begin + if Val <> FFocusControl then begin + FFocusControl:= Val; + if Val <> nil then Val.FreeNotification(Self); + end; +end; + +{------------------------------------------------------------------------------ + Method: TCustomStaticText.SetLayout + Params: None + Returns: Nothing + + ------------------------------------------------------------------------------} +procedure TCustomStaticText.SetLayout(Value: TTextLayout); +begin + if FLayout <> Value then begin + FLayout:= Value; + if HandleAllocated then + TWSCustomStaticTextClass(WidgetSetClass).SetLayout(Self, Value); + end; +end; + +{------------------------------------------------------------------------------ + Method: TCustomStaticText.SetShowAccelChar + Params: Val - new property value + Returns: Nothing + + ------------------------------------------------------------------------------} +procedure TCustomStaticText.SetShowAccelChar(Val: boolean); +begin + if Val <> FShowAccelChar then begin + FShowAccelChar:= Val; + if HandleAllocated then + TWSWinControlClass(WidgetSetClass).SetText(Self,Caption); + end; +end; + +{$IFNDEF EnablePreferredSize} +procedure TCustomStaticText.DoAutoSize; +var + R: TRect; + DC: hDC; +begin + If AutoSizing or (not AutoSize) or (Caption='') then Exit; if (not HandleAllocated) or ([csLoading,csDestroying]*ComponentState<>[]) then exit; @@ -40,53 +143,18 @@ begin R := Rect(0,0, Width, Height); If BorderStyle <> sbsNone then InflateRect(R, -2, -2); - SelectObject(DC, Font.Handle); - DrawText(DC, PChar(Caption), Length(Caption), R, - DT_CalcRect or DT_NoPrefix or DT_WordBreak); + DrawText(DC, PChar(Caption + 'W'), Length(Caption) + 1, R, + DT_CalcRect or DT_NoPrefix or DT_Internal); If BorderStyle <> sbsNone then InflateRect(R, 2, 2); - - Width := R.Right - R.Left; - Height := R.Bottom - R.Top; + Width := R.Right; + Height := R.Bottom; Finally ReleaseDC(Handle, DC); AutoSizing := False; end; end; - -Procedure TCustomStaticText.SetAlignment(Value : TAlignment); -begin - If FAlignment <> Value then begin - FAlignment := Value; - Invalidate; - end; -end; - -procedure TCustomStaticText.Notification(AComponent : TComponent; Operation : TOperation); -begin - inherited Notification(AComponent, Operation); - if (AComponent = FFocusControl) and (Operation = opRemove) then - FFocusControl:= nil; -end; - -procedure TCustomStaticText.SetFocusControl(Value : TWinControl); -begin - if Value <> FFocusControl then begin - FFocusControl:= Value; - if Value <> nil then Value.FreeNotification(Self); - end; -end; - -procedure TCustomStaticText.WMActivate(var Message: TLMActivate); -begin - if (FFocusControl <> nil) and (FFocusControl.CanFocus) then - FFocusControl.SetFocus; -end; - -Function TCustomStaticText.GetAlignment : TAlignment; -begin - Result := FAlignment; -end; +{$ENDIF} Procedure TCustomStaticText.SetStaticBorderStyle(Value : TStaticBorderStyle); begin @@ -101,124 +169,94 @@ begin Result := FStaticBorderStyle; end; -Procedure TCustomStaticText.SetShowAccelChar(Value : Boolean); +{------------------------------------------------------------------------------ + Method: TCustomStaticText.WMActivate + Params: Message: Activation message + Returns: Nothing + + Received when the label has a registered activation shortcut for focuscontrol. + ------------------------------------------------------------------------------} +procedure TCustomStaticText.WMActivate(var Message: TLMActivate); begin - If FShowAccelChar <> Value then begin - FShowAccelChar := Value; - Invalidate; - end; + if (FFocusControl <> nil) and (FFocusControl.CanFocus) then + FFocusControl.SetFocus; end; -procedure TCustomStaticText.CMTextChanged(var Message: TLMSetText); -begin - Invalidate; -end; +// included by stdctrls.pp -Function TCustomStaticText.GetShowAccelChar : Boolean; -begin - Result := FShowAccelChar; -end; +{ ============================================================================= -function TCustomStaticText.CanTab: boolean; -begin - Result:=false; -end; - -constructor TCustomStaticText.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - Font.OnChange := @FontChange; - ControlStyle := [csSetCaption, csOpaque, csClickEvents, csDoubleClicks, - csReplicatable]; - Width := 65; - Height := 17; -end; - -Procedure TCustomStaticText.Paint; -var - TR : TTextStyle; - R : TRect; -begin - R := Rect(0,0,Width,Height); - With Canvas do begin - Color := Self.Color; - Font := Self.Font; - if Color<>clNone then - FillRect(R); - If BorderStyle <> sbsNone then begin - InflateRect(R,-2,-2); - Pen.Style := psSolid; - If BorderStyle = sbsSunken then - Pen.Color := clBtnShadow - else - Pen.Color := clBtnHighlight; - MoveTo(0, 0); - LineTo(Width - 1,0); - MoveTo(0, 0); - LineTo(0,Height - 1); - If BorderStyle = sbsSunken then - Pen.Color := clBtnHighlight - else - Pen.Color := clBtnShadow; - MoveTo(0,Height - 1); - LineTo(Width - 1,Height - 1); - MoveTo(Width - 1, 0); - LineTo(Width - 1,Height); - end; - FillChar(TR,SizeOf(TR),0); - With TR do begin - Alignment := Self.Alignment; - WordBreak := True; - Clipping := True; - ShowPrefix := ShowAccelChar; - SystemFont:=false; - end; - TextRect(R, R.Left, R.Top, Caption, TR); - end; -end; - -Procedure TCustomStaticText.FontChange(Sender : TObject); -begin - If Caption <> '' then - Invalidate; -end; - - // included by stdctrls.pp - - -{ $Log$ - Revision 1.9 2004/12/31 11:27:35 mattias - skip FillRect in TStaticText.Paint when Color=clNone + Revision 1.10 2005/01/07 20:51:11 micha + swap TCustomStaticText and TCustomLabel - Revision 1.8 2004/09/24 13:45:32 mattias - fixed TCanvas.TextRect Delphi compatible Rect and added TBarChart from Michael VC + Revision 1.19 2004/11/03 14:18:35 mattias + implemented preferred size for controls for theme depending AutoSizing - Revision 1.7 2004/08/04 09:57:17 mattias - TStaticText.CanTab=false + Revision 1.18 2004/09/25 15:05:38 mattias + implemented Rename Identifier - Revision 1.6 2004/05/21 09:03:55 micha - implement new borderstyle - - centralize to twincontrol (protected) - - public expose at tcustomcontrol to let interface access it + Revision 1.17 2004/09/22 14:50:18 micha + convert LM_SETPROPERTIES message for tcustomlabel to interface methods - Revision 1.5 2004/04/10 17:58:57 mattias + Revision 1.16 2004/09/10 09:43:12 micha + convert LM_SETLABEL message to interface methods + + Revision 1.15 2004/04/20 23:39:01 marc + * Fixed setting of TWincontrol.Text during load + + Revision 1.14 2004/04/10 17:58:57 mattias implemented mainunit hints for include files - Revision 1.4 2004/03/07 09:37:20 mattias + Revision 1.13 2004/03/08 22:36:01 mattias + added TWinControl.ParentFormInitializeWnd + + Revision 1.12 2004/03/07 09:37:20 mattias added workaround for AutoSize in TCustomLabel - Revision 1.3 2004/01/03 23:14:59 mattias - default font can now change height and fixed gtk crash + Revision 1.11 2004/02/23 08:19:04 micha + revert intf split - Revision 1.2 2002/10/23 20:47:26 lazarus - AJ: Started Form Scrolling - Started StaticText FocusControl - Fixed Misc Dialog Problems - Added TApplication.Title + Revision 1.9 2003/02/28 19:10:25 mattias + added new ... dialog - Revision 1.1 2002/10/21 15:51:27 lazarus - AJ: moved TCustomStaticText code to include/customstatictext.inc + Revision 1.8 2002/10/16 17:06:33 lazarus + MG: fixed handle allocating in TLabel + + Revision 1.7 2002/10/03 00:08:50 lazarus + AJ: TCustomLabel Autosize, TCustomCheckbox '&' shortcuts started + + Revision 1.6 2002/09/03 20:02:01 lazarus + Intermediate UI patch to show a bug. + + Revision 1.5 2002/09/03 11:32:49 lazarus + + Added shortcut keys to labels + Support for alphabetically sorting the properties + Standardize message and add shortcuts ala Kylix + Published BorderStyle, unpublished BorderWidth + ShowAccelChar and FocusControl + ShowAccelChar and FocusControl for TLabel, escaped ampersands now work. + + Revision 1.4 2002/08/30 10:06:07 lazarus + Fixed alignment of multiline TLabel. + Simplified and prettified MessageBoxen. + + Revision 1.3 2002/05/10 06:05:52 lazarus + MG: changed license to LGPL + + Revision 1.2 2002/04/18 08:09:03 lazarus + MG: added include comments + + Revision 1.1 2000/07/13 10:28:25 michael + + Initial import + + Revision 1.3 2000/05/30 22:28:41 lazarus + MWE: + Applied patches from Vincent Snijders: + + Added GetWindowRect + * Fixed horz label alignment + + Added vert label alignment } diff --git a/lcl/interfaces/gtk/gtkobject.inc b/lcl/interfaces/gtk/gtkobject.inc index c0b654c8af..5d3f62cdd8 100644 --- a/lcl/interfaces/gtk/gtkobject.inc +++ b/lcl/interfaces/gtk/gtkobject.inc @@ -3846,7 +3846,7 @@ begin end; end; - csLabel: + csStaticText: Begin SetCallback(LM_GRABFOCUS, AGTKObject, ALCLObject); end; @@ -5151,11 +5151,11 @@ begin end; - csLabel : + csStaticText: begin P := gtk_label_new(StrTemp); - SetLabelAlignment(PGtkLabel(p),TCustomLabel(Sender).Alignment, - TCustomLabel(Sender).Layout); + SetLabelAlignment(PGtkLabel(p),TCustomStaticText(Sender).Alignment, + TCustomStaticText(Sender).Layout); SetupProps:= true; end; @@ -6944,6 +6944,9 @@ end; { ============================================================================= $Log$ + Revision 1.613 2005/01/07 20:51:11 micha + swap TCustomStaticText and TCustomLabel + Revision 1.612 2005/01/01 18:56:47 mattias implemented TTIProgressBar diff --git a/lcl/interfaces/gtk/gtkwscontrols.pp b/lcl/interfaces/gtk/gtkwscontrols.pp index 1210b9b18b..9d1c9d3459 100644 --- a/lcl/interfaces/gtk/gtkwscontrols.pp +++ b/lcl/interfaces/gtk/gtkwscontrols.pp @@ -343,12 +343,12 @@ begin if GtkWidgetIsA(p,gtk_window_get_type) then gtk_window_set_title(pGtkWindow(p),PLabel); - csLabel: + csStaticText: begin - if TLabel(AWinControl).ShowAccelChar then begin - If TLabel(AWinControl).WordWrap and (TLabel(AWinControl).Caption<>'') then begin + if TStaticText(AWinControl).ShowAccelChar then begin + If {TStaticText(AWinControl).WordWrap and }(TStaticText(AWinControl).Caption<>'') then begin DC := GetDC(HDC(GetStyleWidget(lgsLabel))); - aLabel := TGtkWidgetSet(InterfaceObject).ForceLineBreaks(DC, pLabel, TLabel(AWinControl).Width, True); + aLabel := TGtkWidgetSet(InterfaceObject).ForceLineBreaks(DC, pLabel, TStaticText(AWinControl).Width, True); DeleteDC(DC); end else @@ -360,14 +360,16 @@ begin StrDispose(aLabel); end; end else begin - If TLabel(AWinControl).WordWrap then begin +{ + If TStaticText(AWinControl).WordWrap then begin DC := GetDC(HDC(GetStyleWidget(lgsLabel))); - aLabel := TGtkWidgetSet(InterfaceObject).ForceLineBreaks(DC, pLabel, TLabel(AWinControl).Width, False); + aLabel := TGtkWidgetSet(InterfaceObject).ForceLineBreaks(DC, pLabel, TStaticText(AWinControl).Width, False); gtk_label_set_text(PGtkLabel(p), aLabel); StrDispose(aLabel); DeleteDC(DC); end else +} gtk_label_set_text(PGtkLabel(p), pLabel); gtk_label_set_pattern(PGtkLabel(p), nil); end; diff --git a/lcl/interfaces/gtk/gtkwsextctrls.pp b/lcl/interfaces/gtk/gtkwsextctrls.pp index 3e6ba2f4d9..c51c5ee366 100644 --- a/lcl/interfaces/gtk/gtkwsextctrls.pp +++ b/lcl/interfaces/gtk/gtkwsextctrls.pp @@ -171,14 +171,6 @@ type public end; - { TGtkWSBoundLabel } - - TGtkWSBoundLabel = class(TWSBoundLabel) - private - protected - public - end; - { TGtkWSCustomLabeledEdit } TGtkWSCustomLabeledEdit = class(TWSCustomLabeledEdit) @@ -411,7 +403,6 @@ initialization // RegisterWSComponent(TRadioGroup, TGtkWSRadioGroup); // RegisterWSComponent(TCustomCheckGroup, TGtkWSCustomCheckGroup); // RegisterWSComponent(TCheckGroup, TGtkWSCheckGroup); -// RegisterWSComponent(TBoundLabel, TGtkWSBoundLabel); // RegisterWSComponent(TCustomLabeledEdit, TGtkWSCustomLabeledEdit); // RegisterWSComponent(TLabeledEdit, TGtkWSLabeledEdit); // RegisterWSComponent(TCustomPanel, TGtkWSCustomPanel); diff --git a/lcl/interfaces/gtk/gtkwsstdctrls.pp b/lcl/interfaces/gtk/gtkwsstdctrls.pp index af250dba5c..58729259a4 100644 --- a/lcl/interfaces/gtk/gtkwsstdctrls.pp +++ b/lcl/interfaces/gtk/gtkwsstdctrls.pp @@ -186,25 +186,23 @@ type public end; - { TGtkWSCustomLabel } + { TGtkWSCustomStaticText } - TGtkWSCustomLabel = class(TWSCustomLabel) + TGtkWSCustomStaticText = class(TWSCustomStaticText) private protected public - class procedure SetAlignment(const ACustomLabel: TCustomLabel; + class procedure SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); override; - class procedure SetLayout(const ACustomLabel: TCustomLabel; + class procedure SetLayout(const ACustomStaticText: TCustomStaticText; const NewLayout: TTextLayout); override; - class procedure SetWordWrap(const ACustomLabel: TCustomLabel; - const NewWordWrap: boolean); override; class procedure GetPreferredSize(const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer); override; end; - { TGtkWSLabel } + { TGtkWSStaticText } - TGtkWSLabel = class(TWSLabel) + TGtkWSStaticText = class(TWSStaticText) private protected public @@ -258,22 +256,6 @@ type public end; - { TGtkWSCustomStaticText } - - TGtkWSCustomStaticText = class(TWSCustomStaticText) - private - protected - public - end; - - { TGtkWSStaticText } - - TGtkWSStaticText = class(TWSStaticText) - private - protected - public - end; - function WidgetGetSelStart(const Widget: PGtkWidget): integer; procedure WidgetSetSelLength(const Widget: PGtkWidget; NewLength: integer); @@ -790,35 +772,28 @@ begin //debugln('TGtkWSCustomEdit.GetPreferredSize ',DbgSName(AWinControl),' PreferredWidth=',dbgs(PreferredWidth),' PreferredHeight=',dbgs(PreferredHeight)); end; -{ TGtkWSCustomLabel } +{ TGtkWSCustomStaticText } -procedure TGtkWSCustomLabel.SetAlignment(const ACustomLabel: TCustomLabel; +procedure TGtkWSCustomStaticText.SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); begin - SetLabelAlignment(PGtkLabel(ACustomLabel.Handle),NewAlignment, - ACustomLabel.Layout); + SetLabelAlignment(PGtkLabel(ACustomStaticText.Handle),NewAlignment, + ACustomStaticText.Layout); end; -procedure TGtkWSCustomLabel.SetLayout(const ACustomLabel: TCustomLabel; +procedure TGtkWSCustomStaticText.SetLayout(const ACustomStaticText: TCustomStaticText; const NewLayout: TTextLayout); begin - ACustomLabel.InvalidatePreferredSize; - SetLabelAlignment(PGtkLabel(ACustomLabel.Handle),ACustomLabel.Alignment, + ACustomStaticText.InvalidatePreferredSize; + SetLabelAlignment(PGtkLabel(ACustomStaticText.Handle),ACustomStaticText.Alignment, NewLayout); end; -procedure TGtkWSCustomLabel.SetWordWrap(const ACustomLabel: TCustomLabel; - const NewWordWrap: boolean); -begin - ACustomLabel.InvalidatePreferredSize; - gtk_label_set_line_wrap(GTK_LABEL(Pointer(ACustomLabel.Handle)), NewWordWrap); -end; - -procedure TGtkWSCustomLabel.GetPreferredSize(const AWinControl: TWinControl; +procedure TGtkWSCustomStaticText.GetPreferredSize(const AWinControl: TWinControl; var PreferredWidth, PreferredHeight: integer); begin GetGTKDefaultWidgetSize(AWinControl,PreferredWidth,PreferredHeight); - //debugln('TGtkWSCustomLabel.GetPreferredSize ',DbgSName(AWinControl),' PreferredWidth=',dbgs(PreferredWidth),' PreferredHeight=',dbgs(PreferredHeight)); + //debugln('TGtkWSCustomStaticText.GetPreferredSize ',DbgSName(AWinControl),' PreferredWidth=',dbgs(PreferredWidth),' PreferredHeight=',dbgs(PreferredHeight)); end; { TGtkWSCustomCheckBox } @@ -1014,14 +989,12 @@ initialization // RegisterWSComponent(TListBox, TGtkWSListBox); RegisterWSComponent(TCustomEdit, TGtkWSCustomEdit); RegisterWSComponent(TCustomMemo, TGtkWSCustomMemo); -// RegisterWSComponent(TCustomLabel, TGtkWSCustomLabel); - RegisterWSComponent(TCustomLabel, TGtkWSCustomLabel); // RegisterWSComponent(TButtonControl, TGtkWSButtonControl); RegisterWSComponent(TCustomCheckBox, TGtkWSCustomCheckBox); // RegisterWSComponent(TCheckBox, TGtkWSCheckBox); // RegisterWSComponent(TToggleBox, TGtkWSToggleBox); // RegisterWSComponent(TRadioButton, TGtkWSRadioButton); -// RegisterWSComponent(TCustomStaticText, TGtkWSCustomStaticText); + RegisterWSComponent(TCustomStaticText, TGtkWSCustomStaticText); // RegisterWSComponent(TStaticText, TGtkWSStaticText); //////////////////////////////////////////////////// end. diff --git a/lcl/interfaces/win32/win32wsextctrls.pp b/lcl/interfaces/win32/win32wsextctrls.pp index 431f97532e..eb8b98e893 100644 --- a/lcl/interfaces/win32/win32wsextctrls.pp +++ b/lcl/interfaces/win32/win32wsextctrls.pp @@ -175,14 +175,6 @@ type public end; - { TWin32WSBoundLabel } - - TWin32WSBoundLabel = class(TWSBoundLabel) - private - protected - public - end; - { TWin32WSCustomLabeledEdit } TWin32WSCustomLabeledEdit = class(TWSCustomLabeledEdit) @@ -517,7 +509,6 @@ initialization // RegisterWSComponent(TRadioGroup, TWin32WSRadioGroup); // RegisterWSComponent(TCustomCheckGroup, TWin32WSCustomCheckGroup); // RegisterWSComponent(TCheckGroup, TWin32WSCheckGroup); -// RegisterWSComponent(TBoundLabel, TWin32WSBoundLabel); // RegisterWSComponent(TCustomLabeledEdit, TWin32WSCustomLabeledEdit); // RegisterWSComponent(TLabeledEdit, TWin32WSLabeledEdit); RegisterWSComponent(TCustomPanel, TWin32WSCustomPanel); diff --git a/lcl/interfaces/win32/win32wsstdctrls.pp b/lcl/interfaces/win32/win32wsstdctrls.pp index d12ce8805a..b879ccfbe9 100644 --- a/lcl/interfaces/win32/win32wsstdctrls.pp +++ b/lcl/interfaces/win32/win32wsstdctrls.pp @@ -187,22 +187,21 @@ type public end; - { TWin32WSCustomLabel } + { TWin32WSCustomStaticText } - TWin32WSCustomLabel = class(TWSCustomLabel) + TWin32WSCustomStaticText = class(TWSCustomStaticText) private protected public class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; override; - class procedure SetAlignment(const ACustomLabel: TCustomLabel; const NewAlignment: TAlignment); override; - class procedure SetLayout(const ACustomLabel: TCustomLabel; const NewLayout: TTextLayout); override; - class procedure SetWordWrap(const ACustomLabel: TCustomLabel; const NewWordWrap: boolean); override; + class procedure SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); override; + class procedure SetLayout(const ACustomStaticText: TCustomStaticText; const NewLayout: TTextLayout); override; end; - { TWin32WSLabel } + { TWin32WSStaticText } - TWin32WSLabel = class(TWSLabel) + TWin32WSStaticText = class(TWSStaticText) private protected public @@ -258,22 +257,6 @@ type const AParams: TCreateParams): HWND; override; end; - { TWin32WSCustomStaticText } - - TWin32WSCustomStaticText = class(TWSCustomStaticText) - private - protected - public - end; - - { TWin32WSStaticText } - - TWin32WSStaticText = class(TWSStaticText) - private - protected - public - end; - { useful helper functions } function EditGetSelStart(WinHandle: HWND): integer; @@ -906,9 +889,9 @@ begin TWin32WidgetSet(InterfaceObject).RecreateWnd(ACustomMemo); end; -{ TWin32WSCustomLabel } +{ TWin32WSCustomStaticText } -function TWin32WSCustomLabel.CreateHandle(const AWinControl: TWinControl; +function TWin32WSCustomStaticText.CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): HWND; var Params: TCreateWindowExParams; @@ -927,29 +910,24 @@ begin Result := Params.Window; end; -procedure TWin32WSCustomLabel.SetAlignment(const ACustomLabel: TCustomLabel; const NewAlignment: TAlignment); +procedure TWin32WSCustomStaticText.SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); var Style: dword; begin - if ACustomLabel.WordWrap then - begin - case NewAlignment of - taLeftJustify: - Style := SS_LEFT; - taCenter: - Style := SS_CENTER; - taRightJustify: - Style := SS_RIGHT; - else - Style := SS_LEFT; // default, shouldn't happen - end; - end else begin - Style := SS_LEFTNOWORDWRAP; + case NewAlignment of + taLeftJustify: + Style := SS_LEFT; + taCenter: + Style := SS_CENTER; + taRightJustify: + Style := SS_RIGHT; + else + Style := SS_LEFT; // default, shouldn't happen end; - UpdateWindowStyle(ACustomLabel.Handle, Style, SS_LEFT or SS_CENTER or SS_RIGHT or SS_LEFTNOWORDWRAP); + UpdateWindowStyle(ACustomStaticText.Handle, Style, SS_LEFT or SS_CENTER or SS_RIGHT or SS_LEFTNOWORDWRAP); end; -procedure TWin32WSCustomLabel.SetLayout(const ACustomLabel: TCustomLabel; const NewLayout: TTextLayout); +procedure TWin32WSCustomStaticText.SetLayout(const ACustomStaticText: TCustomStaticText; const NewLayout: TTextLayout); var Style: dword; begin @@ -962,12 +940,7 @@ begin {tlBottom:} Style := BS_BOTTOM; end; - UpdateWindowStyle(ACustomLabel.Handle, Style, BS_TOP or BS_VCENTER or BS_BOTTOM); -end; - -procedure TWin32WSCustomLabel.SetWordWrap(const ACustomLabel: TCustomLabel; const NewWordWrap: boolean); -begin - SetAlignment(ACustomLabel, ACustomLabel.Alignment); + UpdateWindowStyle(ACustomStaticText.Handle, Style, BS_TOP or BS_VCENTER or BS_BOTTOM); end; { TWin32WSCustomCheckBox } @@ -1089,15 +1062,13 @@ initialization RegisterWSComponent(TCustomMemo, TWin32WSCustomMemo); // RegisterWSComponent(TEdit, TWin32WSEdit); // RegisterWSComponent(TMemo, TWin32WSMemo); - RegisterWSComponent(TCustomLabel, TWin32WSCustomLabel); -// RegisterWSComponent(TLabel, TWin32WSLabel); // RegisterWSComponent(TButtonControl, TWin32WSButtonControl); RegisterWSComponent(TCustomCheckBox, TWin32WSCustomCheckBox); // RegisterWSComponent(TCheckBox, TWin32WSCheckBox); // RegisterWSComponent(TCheckBox, TWin32WSCheckBox); RegisterWSComponent(TToggleBox, TWin32WSToggleBox); RegisterWSComponent(TRadioButton, TWin32WSRadioButton); -// RegisterWSComponent(TCustomStaticText, TWin32WSCustomStaticText); + RegisterWSComponent(TCustomStaticText, TWin32WSCustomStaticText); // RegisterWSComponent(TStaticText, TWin32WSStaticText); //////////////////////////////////////////////////// end. diff --git a/lcl/lcltype.pp b/lcl/lcltype.pp index 914ded7cdc..a8588a0b0f 100644 --- a/lcl/lcltype.pp +++ b/lcl/lcltype.pp @@ -2014,7 +2014,7 @@ const csCheckbox = 5; csEdit = 6; csForm= 7; - csLabel = 8; + csStaticText = 8; // csgtkTable = 9; csScrollBar = 10; csListView = 11; @@ -2154,8 +2154,8 @@ Begin Result := 'csEdit'; csForm: Result := 'csForm'; - csLabel: - Result := 'csLabel'; + csStaticText: + Result := 'csStaticText'; // csGTKTable: // Result := 'csGTKTable'; csScrollBar: @@ -2272,6 +2272,9 @@ end. { $Log$ + Revision 1.73 2005/01/07 20:51:10 micha + swap TCustomStaticText and TCustomLabel + Revision 1.72 2004/12/22 19:56:44 mattias started TFont mirgration to fpCanvas font diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index fa053b0825..7a8c006ca4 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -735,18 +735,21 @@ type end; - { TCustomLabel } + { TCustomStaticText } - TCustomLabel = class(TWinControl) + TStaticBorderStyle = (sbsNone, sbsSingle, sbsSunken); + + TCustomStaticText = class(TWinControl) private FAlignment: TAlignment; - FWordWrap: Boolean; FLayout: TTextLayout; FFocusControl: TWinControl; FShowAccelChar: boolean; + FStaticBorderStyle: TStaticBorderStyle; procedure SetAlignment(Value: TAlignment); procedure SetLayout(Value: TTextLayout); - procedure SetWordWrap(Value: Boolean); + procedure SetStaticBorderStyle(Value: TStaticBorderStyle); + function GetStaticBorderStyle: TStaticBorderStyle; procedure WMActivate(var Message: TLMActivate); message LM_ACTIVATE; protected function GetLabelText: String ; virtual; @@ -759,23 +762,25 @@ type {$ENDIF} public constructor Create(AOwner: TComponent); override; + property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify; + property BorderStyle: TStaticBorderStyle read GetStaticBorderStyle write SetStaticBorderStyle; property FocusControl: TWinControl read FFocusControl write SetFocusControl; property Layout: TTextLayout read FLayout write SetLayout default tlTop; property ShowAccelChar: boolean read FShowAccelChar write SetShowAccelChar default true; - property WordWrap: Boolean read FWordWrap write SetWordWrap default false; end; - { TLabel } + { TStaticText } - TLabel = class(TCustomLabel) + TStaticText = class(TCustomStaticText) published property Align; property Alignment; property Anchors; property AutoSize; property BorderSpacing; + property BorderStyle; property Caption; property Color; property Constraints; @@ -794,7 +799,6 @@ type property ParentFont; property ShowAccelChar; property Visible; - property WordWrap; end; @@ -1074,53 +1078,52 @@ type end; - { TStaticText } + { TLabel } - TStaticBorderStyle = (sbsNone, sbsSingle, sbsSunken); - - TCustomStaticText = class(TCustomControl) + TCustomLabel = class(TGraphicControl) Private FAlignment: TAlignment; - FStaticBorderStyle: TStaticBorderStyle; FFocusControl: TWinControl; FShowAccelChar: Boolean; + FWordWrap: Boolean; + FLayout: TTextLayout; Procedure FontChange(Sender: TObject); protected - Procedure DoAutoSize; Override; - Procedure CMTextChanged(var Message: TLMSetText); message CM_TEXTCHANGED; + function CanTab: boolean; override; + procedure DoAutoSize; override; + procedure CMTextChanged(var Message: TLMSetText); message CM_TEXTCHANGED; procedure WMActivate(var Message: TLMActivate); message LM_ACTIVATE; procedure Notification(AComponent: TComponent; Operation: TOperation); override; - Procedure SetAlignment(Value: TAlignment); - Function GetAlignment: TAlignment; - Procedure SetStaticBorderStyle(Value: TStaticBorderStyle); - Function GetStaticBorderStyle: TStaticBorderStyle; - Procedure SetFocusControl(Value: TWinControl); - Procedure SetShowAccelChar(Value: Boolean); - Function GetShowAccelChar: Boolean; - function CanTab: boolean; override; + function GetShowAccelChar: Boolean; + function GetAlignment: TAlignment; + procedure SetAlignment(Value: TAlignment); + procedure SetFocusControl(Value: TWinControl); + procedure SetLayout(Value: TTextLayout); + procedure SetShowAccelChar(Value: Boolean); + procedure SetWordWrap(Value: Boolean); property Alignment: TAlignment read GetAlignment write SetAlignment; - property BorderStyle: TStaticBorderStyle read GetStaticBorderStyle write SetStaticBorderStyle; property FocusControl: TWinControl read FFocusControl write SetFocusControl; + property Layout: TTextLayout read FLayout write SetLayout default tlTop; property ShowAccelChar: Boolean read GetShowAccelChar write SetShowAccelChar; + property WordWrap: Boolean read FWordWrap write SetWordWrap default false; public constructor Create(AOwner: TComponent); override; - Procedure Paint; override; + procedure Paint; override; end; - { TStaticText } + { TLabel } - TStaticText = class(TCustomStaticText) + TLabel = class(TCustomLabel) published property Align; property Alignment; property Anchors; property AutoSize; property BorderSpacing; - property BorderStyle; property Caption; property Color; property Constraints; @@ -1136,6 +1139,7 @@ type property TabOrder; property TabStop; property Visible; + property WordWrap; property OnClick; property OnDblClick; property OnMouseDown; @@ -1213,6 +1217,9 @@ end. { ============================================================================= $Log$ + Revision 1.178 2005/01/07 20:51:11 micha + swap TCustomStaticText and TCustomLabel + Revision 1.177 2005/01/01 19:36:40 mattias fixed loading TRadioButton.Checked diff --git a/lcl/widgetset/wsdbctrls.pp b/lcl/widgetset/wsdbctrls.pp index ab80c80e33..98dd3484a3 100644 --- a/lcl/widgetset/wsdbctrls.pp +++ b/lcl/widgetset/wsdbctrls.pp @@ -55,11 +55,6 @@ type TWSDBEdit = class(TWSCustomMaskEdit) end; - { TWSDBText } - - TWSDBText = class(TWSLabel) - end; - { TWSDBListBox } TWSDBListBox = class(TWSCustomListBox) @@ -125,7 +120,6 @@ initialization // which actually implement something //////////////////////////////////////////////////// // RegisterWSComponent(TDBEdit, TWSDBEdit); -// RegisterWSComponent(TDBText, TWSDBText); // RegisterWSComponent(TDBListBox, TWSDBListBox); // RegisterWSComponent(TDBRadioGroup, TWSDBRadioGroup); // RegisterWSComponent(TDBCheckBox, TWSDBCheckBox); diff --git a/lcl/widgetset/wsextctrls.pp b/lcl/widgetset/wsextctrls.pp index 5917a0ec5a..8e8fc131e4 100644 --- a/lcl/widgetset/wsextctrls.pp +++ b/lcl/widgetset/wsextctrls.pp @@ -137,11 +137,6 @@ type TWSCheckGroup = class(TWSCustomCheckGroup) end; - { TWSBoundLabel } - - TWSBoundLabel = class(TWSCustomLabel) - end; - { TWSCustomLabeledEdit } TWSCustomLabeledEdit = class(TWSCustomEdit) @@ -276,7 +271,6 @@ initialization // RegisterWSComponent(TRadioGroup, TWSRadioGroup); // RegisterWSComponent(TCustomCheckGroup, TWSCustomCheckGroup); // RegisterWSComponent(TCheckGroup, TWSCheckGroup); -// RegisterWSComponent(TBoundLabel, TWSBoundLabel); // RegisterWSComponent(TCustomLabeledEdit, TWSCustomLabeledEdit); // RegisterWSComponent(TLabeledEdit, TWSLabeledEdit); // RegisterWSComponent(TCustomPanel, TWSCustomPanel); diff --git a/lcl/widgetset/wsstdctrls.pp b/lcl/widgetset/wsstdctrls.pp index ef0f8d6ba8..155e0e9e74 100644 --- a/lcl/widgetset/wsstdctrls.pp +++ b/lcl/widgetset/wsstdctrls.pp @@ -151,18 +151,17 @@ type TWSMemo = class(TWSCustomMemo) end; - { TWSCustomLabel } + { TWSCustomStaticText } - TWSCustomLabel = class(TWSWinControl) - class procedure SetAlignment(const ACustomLabel: TCustomLabel; const NewAlignment: TAlignment); virtual; - class procedure SetLayout(const ACustomLabel: TCustomLabel; const NewLayout: TTextLayout); virtual; - class procedure SetWordWrap(const ACustomLabel: TCustomLabel; const NewWordWrap: boolean); virtual; + TWSCustomStaticTextClass = class of TWSCustomStaticText; + TWSCustomStaticText = class(TWSWinControl) + class procedure SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); virtual; + class procedure SetLayout(const ACustomStaticText: TCustomStaticText; const NewLayout: TTextLayout); virtual; end; - TWSCustomLabelClass = class of TWSCustomLabel; - { TWSLabel } + { TWSStaticText } - TWSLabel = class(TWSCustomLabel) + TWSStaticText = class(TWSCustomStaticText) end; { TWSButtonControl } @@ -195,16 +194,6 @@ type TWSRadioButton = class(TWSCustomCheckBox) end; - { TWSCustomStaticText } - - TWSCustomStaticText = class(TWSCustomControl) - end; - - { TWSStaticText } - - TWSStaticText = class(TWSCustomStaticText) - end; - implementation @@ -380,17 +369,13 @@ procedure TWSCustomMemo.SetWordWrap(const ACustomMemo: TCustomMemo; const NewWor begin end; -{ TWSCustomLabel } +{ TWSCustomStaticText } -procedure TWSCustomLabel.SetAlignment(const ACustomLabel: TCustomLabel; const NewAlignment: TAlignment); +procedure TWSCustomStaticText.SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); begin end; -procedure TWSCustomLabel.SetLayout(const ACustomLabel: TCustomLabel; const NewLayout: TTextLayout); -begin -end; - -procedure TWSCustomLabel.SetWordWrap(const ACustomLabel: TCustomLabel; const NewWordWrap: boolean); +procedure TWSCustomStaticText.SetLayout(const ACustomStaticText: TCustomStaticText; const NewLayout: TTextLayout); begin end; @@ -426,15 +411,14 @@ initialization // RegisterWSComponent(TCustomMemo, TWSCustomMemo); // RegisterWSComponent(TEdit, TWSEdit); // RegisterWSComponent(TMemo, TWSMemo); -// RegisterWSComponent(TCustomLabel, TWSCustomLabel); -// RegisterWSComponent(TLabel, TWSLabel); +// RegisterWSComponent(TCustomStaticText, TWSCustomStaticText); +// RegisterWSComponent(TStaticText, TWSStaticText); // RegisterWSComponent(TButtonControl, TWSButtonControl); // RegisterWSComponent(TCustomCheckBox, TWSCustomCheckBox); // RegisterWSComponent(TCheckBox, TWSCheckBox); // RegisterWSComponent(TCheckBox, TWSCheckBox); // RegisterWSComponent(TToggleBox, TWSToggleBox); // RegisterWSComponent(TRadioButton, TWSRadioButton); -// RegisterWSComponent(TCustomStaticText, TWSCustomStaticText); -// RegisterWSComponent(TStaticText, TWSStaticText); +// RegisterWSComponent(TLabel, TWSLabel); //////////////////////////////////////////////////// end.