- Publish TListView ShowHint, ParentShowHint (9708).
- Correct TTabControl drawing. Don't clear tab area since it is painted by notebook. Draw pane area with ThemeServices. 
- Teach gtk ThemeServices to draw notebook pane.

git-svn-id: trunk@15027 -
This commit is contained in:
paul 2008-05-01 18:26:50 +00:00
parent e473ecf7d5
commit 3108f60f93
4 changed files with 79 additions and 18 deletions

View File

@ -450,6 +450,7 @@ type
function GetScrollOpposite: Boolean;
function GetTabHeight: Smallint;
function GetTabIndex: Integer;
function GetTabRectWithBorder: TRect;
function GetTabWidth: Smallint;
procedure SetHotTrack(const AValue: Boolean);
procedure SetImages(const AValue: TCustomImageList);
@ -1077,11 +1078,13 @@ type
property MultiSelect;
// property OwnerData;
// property OwnerDraw;
property ParentShowHint;
property PopupMenu;
property ReadOnly;
property RowSelect;
property ScrollBars;
property ShowColumnHeaders;
property ShowHint;
// property ShowWorkAreas;
property SmallImages;
property SortColumn;

View File

@ -266,8 +266,8 @@ end;
function TTabControlNoteBookStrings.GetSize: integer;
begin
case TabControl.TabPosition of
tpTop, tpBottom: Result:=FNoteBook.Height;
tpLeft, tpRight: Result:=FNoteBook.Width;
tpTop, tpBottom: Result:=FNoteBook.Height;
tpLeft, tpRight: Result:=FNoteBook.Width;
end;
end;
@ -539,21 +539,22 @@ end;
procedure TCustomTabControl.Paint;
var
ARect: TRect;
TS : TTextStyle;
TS: TTextStyle;
Details: TThemedElementDetails;
begin
//DebugLn(['TCustomTabControl.Paint Bounds=',dbgs(BoundsRect),' ClientRect=',dbgs(ClientRect),' CientOrigin=',dbgs(ClientOrigin)]);
// clear the whole area
// Note: The tabs are painted above and are not opaque. So the background of
// the tabs must be painted here
ARect:=ClientRect;
Canvas.Brush.Color:=clBackground;
Canvas.FillRect(ARect);
// clear only display area since button area is painted by another control
// draw a frame
ARect:=GetDisplayRectWithBorder;
ARect := GetDisplayRectWithBorder;
Details := ThemeServices.GetElementDetails(ttPane);
ThemeServices.DrawElement(Canvas.Handle, Details, ARect);
InflateRect(ARect,BorderWidth,BorderWidth);
Canvas.Frame3d(ARect, BorderWidth, bvRaised);
if (csDesigning in ComponentState) and (Caption <> '') then begin
if (csDesigning in ComponentState) and (Caption <> '') then
begin
ARect:=GetDisplayRect;
TS := Canvas.TextStyle;
TS.Alignment:=taCenter;
@ -568,19 +569,33 @@ function TCustomTabControl.GetDisplayRectWithBorder: TRect;
var
TabAreaSize: LongInt;
begin
Result:=ClientRect;
TabAreaSize:=TTabControlStrings(FTabs).GetSize;
Result := ClientRect;
TabAreaSize := TTabControlStrings(FTabs).GetSize;
case TabPosition of
tpTop: Result.Top:=Min(TabAreaSize,Result.Bottom);
tpBottom: Result.Bottom:=Max(Result.Bottom-TabAreaSize,Result.Top);
tpLeft: Result.Left:=Min(TabAreaSize,Result.Right);
tpRight: Result.Right:=Max(Result.Right-TabAreaSize,Result.Left);
tpTop: Result.Top:=Min(TabAreaSize,Result.Bottom);
tpBottom: Result.Bottom:=Max(Result.Bottom-TabAreaSize,Result.Top);
tpLeft: Result.Left:=Min(TabAreaSize,Result.Right);
tpRight: Result.Right:=Max(Result.Right-TabAreaSize,Result.Left);
end;
end;
function TCustomTabControl.GetTabRectWithBorder: TRect;
var
TabAreaSize: LongInt;
begin
Result := ClientRect;
TabAreaSize := TTabControlStrings(FTabs).GetSize;
case TabPosition of
tpTop: Result.Bottom:=Min(TabAreaSize,Result.Bottom);
tpBottom: Result.Top:=Max(Result.Bottom-TabAreaSize,Result.Top);
tpLeft: Result.Right:=Min(TabAreaSize,Result.Right);
tpRight: Result.Left:=Max(Result.Right-TabAreaSize,Result.Left);
end;
end;
procedure TCustomTabControl.AdjustClientRect(var ARect: TRect);
begin
ARect:=GetDisplayRect;
ARect := GetDisplayRect;
end;
constructor TCustomTabControl.Create(TheOwner: TComponent);

View File

@ -27,6 +27,7 @@ type
gptVLine,
gptShadow,
gptBox,
gptBoxGap,
gptFlatBox,
gptCheck,
gptOption,
@ -52,6 +53,9 @@ type
Orientation: TGtkOrientation; // Orientation (horizontal/vertical)
ArrowType : TGtkArrowType; // type of arrow
Fill : Boolean; // fill inside area
GapSide : TGtkPositionType;//
GapX : gint;
GapWidth : gint;
{$ifdef gtk2}
Expander : TGtkExpanderStyle; // treeview expander
Edge : TGdkWindowEdge;
@ -214,6 +218,9 @@ begin
Result.ArrowType := GTK_ARROW_UP;
Result.Fill := False;
Result.IsHot := False;
Result.GapSide := GTK_POS_LEFT;
Result.GapWidth := 0;
Result.GapX := 0;
case Details.Element of
teButton:
@ -375,6 +382,20 @@ to alternate splitter painting}
Result.Painter := gptPixmap;
end;
end;
teTab:
begin
Result.Widget := GetStyleWidget(lgsNotebook);
Result.State := GTK_STATE_NORMAL;
Result.Shadow := GTK_SHADOW_OUT;
Result.Detail := 'notebook';
if Details.Part in [TABP_PANE, TABP_BODY] then
begin
Result.GapSide := GTK_POS_TOP;
Result.GapX := 20;
Result.GapWidth := 40;
Result.Painter := gptBoxGap;
end;
end;
end;
end;
@ -437,6 +458,14 @@ begin
@Area, Widget, PChar(Detail),
Area.x, Area.y,
Area.Width, Area.Height);
gptBoxGap:
gtk_paint_box_gap(
Style, Window,
State, Shadow,
@Area, Widget, PChar(Detail),
Area.x, Area.y,
Area.Width, Area.Height,
GapSide, GapX, GapWidth);
gptHLine : gtk_paint_hline(
Style, Window,
State, @Area,

View File

@ -1830,6 +1830,15 @@ procedure TThemeServices.DrawElement(DC: HDC; Details: TThemedElementDetails; co
inc(ARect.Right, 2);
LCLIntf.DrawEdge(DC, ARect, EDGE_ETCHED, BF_LEFT);
end;
procedure FillWithColor(ARect: TRect; AColor: TColor);
var
Brush: HBrush;
begin
Brush := CreateSolidBrush(ColorToRGB(AColor));
FillRect(DC, ARect, Brush);
DeleteObject(Brush);
end;
var
ADrawFlags: DWord;
@ -1942,6 +1951,11 @@ begin
WidgetSet.DrawFrameControl(DC, ARect, DFC_CAPTION, ADrawFlags);
end;
teTab:
begin
if Details.Part in [TABP_PANE, TABP_BODY] then
FillWithColor(ARect, clBackground);
end;
end;
end;