fixed grids SetBorderStyle

git-svn-id: trunk@5499 -
This commit is contained in:
mattias 2004-05-22 11:06:27 +00:00
parent c9f9f10d1a
commit e79a9e2cb3
5 changed files with 48 additions and 12 deletions

View File

@ -55,7 +55,8 @@ type
TGetIDEFileStateEvent = procedure(Sender: TObject; const Filename: string; TGetIDEFileStateEvent = procedure(Sender: TObject; const Filename: string;
NeededFlags: TIDEFileStateFlags; var ResultFlags: TIDEFileStateFlags) NeededFlags: TIDEFileStateFlags; var ResultFlags: TIDEFileStateFlags)
of object; of object;
implementation implementation
end. end.

View File

@ -1179,6 +1179,8 @@ var
HsbVisible, VsbVisible: boolean; HsbVisible, VsbVisible: boolean;
HsbRange, VsbRange: Integer; HsbRange, VsbRange: Integer;
begin begin
if FCols=nil then exit; // not yet initialized or already destroyed
// Calculate New Cached Values // Calculate New Cached Values
FGCache.GridWidth:=0; FGCache.GridWidth:=0;
FGCache.FixedWidth:=0; FGCache.FixedWidth:=0;
@ -2304,10 +2306,12 @@ begin
if BorderStyle<>NewStyle then if BorderStyle<>NewStyle then
begin begin
inherited; inherited;
if HandleAllocated and ([csDestroying,csLoading]*ComponentState=[]) then
VisualChange; begin
if CheckTopLeft(Col, Row, True, True) then
VisualChange; VisualChange;
if CheckTopLeft(Col, Row, True, True) then
VisualChange;
end;
end; end;
end; end;
@ -2320,7 +2324,8 @@ begin
VisibleGrid:=GetVisibleGrid; VisibleGrid:=GetVisibleGrid;
with VisibleGrid do with VisibleGrid do
ValidGrid:=(Left>=0)and(Top>=0)and(Right>=Left)and(Bottom>=Top); ValidGrid:=(Left>=0)and(Top>=0)and(Right>=Left)and(Bottom>=Top);
if not ValidGrid then MaxClientXY:=Point(0,0) if not ValidGrid then
MaxClientXY:=Point(0,0)
else begin else begin
R:=CellRect(VisibleGrid.Right, VisibleGrid.Bottom); R:=CellRect(VisibleGrid.Right, VisibleGrid.Bottom);
MaxClientXY:=R.BottomRight; MaxClientXY:=R.BottomRight;
@ -2524,7 +2529,8 @@ end;
// ex: IsCol=true, Index:=100, TopLeft.x:=98, FixedCols:=1, all ColWidths:=20 // ex: IsCol=true, Index:=100, TopLeft.x:=98, FixedCols:=1, all ColWidths:=20
// Fisical = Relative => Ini := WidthfixedCols+WidthCol98+WidthCol99 // Fisical = Relative => Ini := WidthfixedCols+WidthCol98+WidthCol99
// Not Fisical = Absolute => Ini := WidthCols(0..99) // Not Fisical = Absolute => Ini := WidthCols(0..99)
function TCustomGrid.ColRowToOffset(IsCol,Fisical:Boolean; index:Integer; var Ini,Fin:Integer): Boolean; function TCustomGrid.ColRowToOffset(IsCol,Fisical:Boolean; index:Integer;
var Ini,Fin:Integer): Boolean;
var var
Dim: Integer; Dim: Integer;
begin begin

View File

@ -983,7 +983,8 @@ begin
// ToDo: implement it. // ToDo: implement it.
// We can not use inherited SetBorderStyle(NewStyle), // We can not use inherited SetBorderStyle(NewStyle),
// because TBorderSTyle <> TFormBorderSTyle; // because TBorderSTyle <> TFormBorderSTyle;
TWSCustomFormClass(WidgetSetClass).SetFormBorderStyle(Self, NewStyle); if HandleAllocated then
TWSCustomFormClass(WidgetSetClass).SetFormBorderStyle(Self, NewStyle);
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
@ -1606,6 +1607,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.140 2004/05/22 11:06:27 mattias
fixed grids SetBorderStyle
Revision 1.139 2004/05/21 18:34:44 mattias Revision 1.139 2004/05/21 18:34:44 mattias
readded protected TWinControl.BorderStyle readded protected TWinControl.BorderStyle

View File

@ -49,6 +49,7 @@ type
TGTKAPIWidget = record TGTKAPIWidget = record
// ! the ScrolledWindow must be the first attribute of this record ! // ! the ScrolledWindow must be the first attribute of this record !
ScrolledWindow: TGTKScrolledWindow; ScrolledWindow: TGTKScrolledWindow;
Frame: PGtkFrame;
Client: PGtkWidget; Client: PGtkWidget;
end; end;
@ -1014,7 +1015,7 @@ const
begin begin
{$IFDEF gtk2} {$IFDEF gtk2}
// MWE: IMO the arguments can't work since we supply the adjustments as nil // MWE: IMO the arguments can't work since we supply the adjustments as nil
// for gtk2 newv doesn't exist so the desision is easy // for gtk2 newv doesn't exist so the decision is easy
// TODO: check if we still need to pass the args in gtk1 // TODO: check if we still need to pass the args in gtk1
Result := gtk_widget_new(GTKAPIWidget_GetType, nil); Result := gtk_widget_new(GTKAPIWidget_GetType, nil);
{$ELSE} {$ELSE}
@ -1024,14 +1025,15 @@ begin
Result := gtk_widget_newv(GTKAPIWidget_GetType, 2, @ARGS[0]); Result := gtk_widget_newv(GTKAPIWidget_GetType, 2, @ARGS[0]);
{$ENDIF} {$ENDIF}
// create client widget
APIWidget := PGTKAPIWidget(Result); APIWidget := PGTKAPIWidget(Result);
gtk_container_set_border_width(PGTKContainer(APIWidget),0);
// create client widget
APIWidget^.Client := GTKAPIWidgetClient_New; APIWidget^.Client := GTKAPIWidgetClient_New;
gtk_object_set_data(PGTKObject(Result), 'Fixed', APIWidget^.Client); gtk_object_set_data(PGTKObject(Result), 'Fixed', APIWidget^.Client);
gtk_object_set_data(PGTKObject(APIWidget^.Client), 'Main', Result); gtk_object_set_data(PGTKObject(APIWidget^.Client), 'Main', Result);
gtk_widget_show(APIWidget^.Client); gtk_widget_show(APIWidget^.Client);
gtk_container_add(PGTKContainer(APIWidget), APIWidget^.Client);
gtk_container_add(PGTKContainer(Result), APIWidget^.Client);
end; end;
procedure GTKAPIWidget_CreateCaret(APIWidget: PGTKAPIWidget; procedure GTKAPIWidget_CreateCaret(APIWidget: PGTKAPIWidget;
@ -1141,6 +1143,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.58 2004/05/22 11:06:27 mattias
fixed grids SetBorderStyle
Revision 1.57 2004/05/11 12:16:48 mattias Revision 1.57 2004/05/11 12:16:48 mattias
replaced writeln by debugln replaced writeln by debugln

View File

@ -66,6 +66,7 @@ type
// Internal public // Internal public
class procedure SetCallbacks(const AGTKObject: PGTKObject; const AComponent: TComponent); class procedure SetCallbacks(const AGTKObject: PGTKObject; const AComponent: TComponent);
public public
class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override;
class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override; class procedure SetBounds(const AWinControl: TWinControl; const ALeft, ATop, AWidth, AHeight: Integer); override;
class procedure SetSize(const AWinControl: TWinControl; const AWidth, AHeight: Integer); override; class procedure SetSize(const AWinControl: TWinControl; const AWidth, AHeight: Integer); override;
class procedure SetPos(const AWinControl: TWinControl; const ALeft, ATop: Integer); override; class procedure SetPos(const AWinControl: TWinControl; const ALeft, ATop: Integer); override;
@ -100,7 +101,7 @@ type
implementation implementation
uses uses
GtkProc, GtkDef, GtkInt; GtkProc, GtkDef, GtkInt, GTKWinapiWindow;
{ TGtkWSWinControl } { TGtkWSWinControl }
@ -138,6 +139,25 @@ begin
GtkWidgetSet.SetCallback(LM_MOUSEWHEEL, AGTKObject, AComponent); GtkWidgetSet.SetCallback(LM_MOUSEWHEEL, AGTKObject, AComponent);
end; end;
procedure TGtkWSWinControl.SetBorderStyle(const AWinControl: TWinControl;
const ABorderStyle: TBorderStyle);
var
Widget: PGtkWidget;
APIWidget: PGTKAPIWidget;
begin
Widget := PGtkWidget(AWinControl.Handle);
if GtkWidgetIsA(Widget,GTKAPIWidget_GetType) then begin
//writeln('TGtkWSWinControl.SetBorderStyle ',AWinControl.Name,':',AWinControl.ClassName,' ',ord(ABorderStyle));
APIWidget := PGTKAPIWidget(Widget);
if (APIWidget^.Frame<>nil) then begin
case ABorderStyle of
bsNone: gtk_frame_set_shadow_type(APIWidget^.Frame,GTK_SHADOW_NONE);
bsSingle: gtk_frame_set_shadow_type(APIWidget^.Frame,GTK_SHADOW_ETCHED_IN);
end;
end;
end;
end;
procedure TGtkWSWinControl.SetCursor(const AControl: TControl; const ACursor: TCursor); procedure TGtkWSWinControl.SetCursor(const AControl: TControl; const ACursor: TCursor);
begin begin
GtkProc.SetCursor(AControl as TWinControl, ACursor); GtkProc.SetCursor(AControl as TWinControl, ACursor);