implemented TSplitter.Beveled for gtk intf

git-svn-id: trunk@8031 -
This commit is contained in:
mattias 2005-11-02 09:10:52 +00:00
parent 713c417a73
commit da78e6e7a4
6 changed files with 95 additions and 15 deletions

View File

@ -7721,7 +7721,7 @@ begin
// MWE: ???
// TODO: why are only the lower bytes of a handle checked ???
// In the LCL a Handle has the size of a PtrUInt
if (TheMessage.WParam and $FFFF) = Handle then begin
if (cardinal(TheMessage.WParam) and $FFFF) = cardinal(Handle) then begin
// what a weird thing, we are losing the focus
// and giving it to ourselves
TheMessage.Result := 0; // doesn't allow such thing

View File

@ -674,8 +674,9 @@ end;
procedure TCustomSplitter.Paint;
begin
DrawSplitter(Canvas.Handle,Rect(0,0,Width,Height),
FResizeAnchor in [akTop,akBottom]);
TWSCustomSplitterClass(WidgetSetClass).DrawSplitter(Self);
//DrawSplitter(Canvas.Handle,Rect(0,0,Width,Height),
// FResizeAnchor in [akTop,akBottom]);
end;
constructor TCustomSplitter.Create(TheOwner: TComponent);

View File

@ -2726,7 +2726,7 @@ begin
SelectedColors := dcscCustom;
// Draw outer rect
if Bouter then
if BOuter then
DrawEdges(R,GC,Drawable,OuterTL,OuterBR);
// Draw inner rect

View File

@ -27,13 +27,13 @@ unit GtkWSExtCtrls;
interface
uses
LCLProc, Controls,
LCLProc, LCLType, LCLIntf, Controls,
{$IFDEF GTK2}
gtk2, gdk2, gdk2PixBuf, glib2,
{$ELSE GTK2}
gtk, gdk, glib,
{$ENDIF GTK2}
GtkGlobals, GtkProc, ExtCtrls, Classes,
GtkGlobals, GtkProc, GtkDef, ExtCtrls, Classes,
WSExtCtrls, WSLCLClasses, gtkint, interfacebase;
type
@ -98,6 +98,7 @@ type
private
protected
public
class procedure DrawSplitter(const ASplitter: TCustomSplitter); override;
end;
{ TGtkWSSplitter }
@ -437,6 +438,57 @@ begin
gtk_notebook_set_show_tabs(PGtkNotebook(ANotebook.Handle), AShowTabs);
end;
{ TGtkWSCustomSplitter }
procedure TGtkWSCustomSplitter.DrawSplitter(const ASplitter: TCustomSplitter);
var
Widget: PGtkWidget;
ClientWidget: Pointer;
DCOrigin: TPoint;
Detail: PChar;
Area: TGdkRectangle;
Style: PGtkStyle;
AWindow: PGdkWindow;
DevContext: TDeviceContext;
ARect: TRect;
begin
if not ASplitter.HandleAllocated then exit;
DevContext:=TDeviceContext(ASplitter.Canvas.Handle);
Widget:=PGtkWidget(ASplitter.Handle);
ClientWidget:=GetFixedWidget(Widget);
if ClientWidget<>nil then
Widget:=ClientWidget;
AWindow:=DevContext.Drawable;
Style:=GetStyle(lgsButton);
if ASplitter.ResizeAnchor in [akTop,akBottom] then begin
Detail:='hpaned';
end else begin
Detail:='vpaned';
end;
DCOrigin:=GetDCOffset(DevContext);
Area.X:=DCOrigin.X;
Area.Y:=DCOrigin.Y;
Area.Width:=ASplitter.Width;
Area.Height:=ASplitter.Height;
if ASplitter.Beveled then begin
ARect:=Bounds(Area.x,Area.y,Area.Width,Area.Height);
DrawEdge(HDC(DevContext),ARect,BDR_RAISEDOUTER,BF_ADJUST+BF_RECT);
Area.X:=ARect.Left;
Area.Y:=ARect.Top;
Area.Width:=ARect.Right-ARect.Left;
Area.Height:=ARect.Bottom-ARect.Top;
end;
gtk_paint_box(Style, AWindow,
GTK_WIDGET_STATE(Widget),
GTK_SHADOW_NONE,
@Area, Widget, Detail,
Area.X,Area.Y,Area.Width,Area.Height);
end;
initialization
////////////////////////////////////////////////////
@ -450,7 +502,7 @@ initialization
// RegisterWSComponent(TPage, TGtkWSPage);
// RegisterWSComponent(TNotebook, TGtkWSNotebook);
// RegisterWSComponent(TShape, TGtkWSShape);
// RegisterWSComponent(TCustomSplitter, TGtkWSCustomSplitter);
RegisterWSComponent(TCustomSplitter, TGtkWSCustomSplitter);
// RegisterWSComponent(TSplitter, TGtkWSSplitter);
// RegisterWSComponent(TPaintBox, TGtkWSPaintBox);
// RegisterWSComponent(TCustomImage, TGtkWSCustomImage);

View File

@ -32,7 +32,7 @@ uses
// To get as little as posible circles,
// uncomment only when needed for registration
////////////////////////////////////////////////////
Windows, ExtCtrls, Classes, Controls, LCLType, SysUtils,
SysUtils, Windows, ExtCtrls, Classes, Controls, LCLType, LCLIntf,
////////////////////////////////////////////////////
WSExtCtrls, WSLCLClasses, WinExt, Win32Int, Win32Proc, InterfaceBase,
Win32WSControls;
@ -104,6 +104,7 @@ type
private
protected
public
class procedure DrawSplitter(const ASplitter: TCustomSplitter); override;
end;
{ TWin32WSSplitter }
@ -534,6 +535,17 @@ end;
{ TWin32WSCustomSplitter }
procedure TWin32WSCustomSplitter.DrawSplitter(const ASplitter: TCustomSplitter
);
begin
// TODO: beveled
LCLIntf.DrawSplitter(ASplitter.Canvas.Handle,
Rect(0,0,ASplitter.Width,ASplitter.Height),
ASplitter.ResizeAnchor in [akTop,akBottom]);
end;
initialization
////////////////////////////////////////////////////
@ -547,7 +559,7 @@ initialization
// RegisterWSComponent(TPage, TWin32WSPage);
// RegisterWSComponent(TNotebook, TWin32WSNotebook);
// RegisterWSComponent(TShape, TWin32WSShape);
// RegisterWSComponent(TCustomSplitter, TWin32WSCustomSplitter);
RegisterWSComponent(TCustomSplitter, TWin32WSCustomSplitter);
// RegisterWSComponent(TSplitter, TWin32WSSplitter);
// RegisterWSComponent(TPaintBox, TWin32WSPaintBox);
// RegisterWSComponent(TCustomImage, TWin32WSCustomImage);

View File

@ -44,7 +44,7 @@ uses
// To get as little as posible circles,
// uncomment only when needed for registration
////////////////////////////////////////////////////
Controls, ExtCtrls, Classes,
LCLProc, Controls, ExtCtrls, Classes,
////////////////////////////////////////////////////
WSLCLClasses, WSControls, WSStdCtrls;
@ -92,7 +92,10 @@ type
{ TWSCustomSplitter }
TWSCustomSplitter = class(TWSCustomControl)
public
class procedure DrawSplitter(const ASplitter: TCustomSplitter); virtual;
end;
TWSCustomSplitterClass = class of TWSCustomSplitter;
{ TWSSplitter }
@ -235,7 +238,8 @@ begin
Result:=60;
end;
function TWSCustomNotebook.GetPageRealIndex(const ANotebook: TCustomNotebook; AIndex: Integer): Integer;
function TWSCustomNotebook.GetPageRealIndex(const ANotebook: TCustomNotebook;
AIndex: Integer): Integer;
begin
Result := AIndex;
end;
@ -246,7 +250,8 @@ begin
Result := -1;
end;
procedure TWSCustomNotebook.SetPageIndex(const ANotebook: TCustomNotebook; const AIndex: integer);
procedure TWSCustomNotebook.SetPageIndex(const ANotebook: TCustomNotebook;
const AIndex: integer);
begin
end;
@ -255,14 +260,24 @@ procedure TWSCustomNotebook.SetTabCaption(const ANotebook: TCustomNotebook;
begin
end;
procedure TWSCustomNotebook.SetTabPosition(const ANotebook: TCustomNotebook; const ATabPosition: TTabPosition);
procedure TWSCustomNotebook.SetTabPosition(const ANotebook: TCustomNotebook;
const ATabPosition: TTabPosition);
begin
end;
procedure TWSCustomNotebook.ShowTabs(const ANotebook: TCustomNotebook; AShowTabs: boolean);
procedure TWSCustomNotebook.ShowTabs(const ANotebook: TCustomNotebook;
AShowTabs: boolean);
begin
end;
{ TWSCustomSplitter }
class procedure TWSCustomSplitter.DrawSplitter(const ASplitter: TCustomSplitter
);
begin
debugln('TWSCustomSplitter.DrawSplitter TODO');
end;
initialization
////////////////////////////////////////////////////
@ -275,7 +290,7 @@ initialization
// RegisterWSComponent(TNotebook, TWSNotebook);
// RegisterWSComponent(TShape, TWSShape);
// RegisterWSComponent(TCustomSplitter, TWSCustomSplitter);
// RegisterWSComponent(TSplitter, TWSSplitter);
// RegisterWSComponent(TCustomSplitter, TWSCustomSplitter);
// RegisterWSComponent(TPaintBox, TWSPaintBox);
// RegisterWSComponent(TCustomImage, TWSCustomImage);
// RegisterWSComponent(TImage, TWSImage);