1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696
|
unit GtkThemes;
{$mode objfpc}{$H+}
interface
uses
// rtl
Types, Classes, SysUtils,
// os
{$ifdef gtk1}
glib, gdk, gtk,
{$else}
glib2, gdk2, gtk2, Pango,
{$endif}
// lcl
InterfaceBase, LCLType, LCLProc, LCLIntf, Graphics, Themes, TmSchema,
// widgetset
gtkdef, gtkint, gtkproc, gtkglobals, gtkextra;
type
TGtkPainterType =
(
gptNone,
gptDefault,
gptHLine,
gptVLine,
gptShadow,
gptBox,
gptBoxGap,
gptFlatBox,
gptCheck,
gptOption,
gptTab,
gptSlider,
gptHandle,
gptExpander,
gptResizeGrip,
gptFocus,
gptArrow,
gptPixmap
);
TGtkStyleParams = record
Style : PGtkStyle; // paint style
Painter : TGtkPainterType; // type of paint handler
Widget : PGtkWidget; // widget
Window : PGdkWindow; // paint window
Origin : TPoint; // offset
State : TGtkStateType; // Style state
Shadow : TGtkShadowType; // Shadow
Detail : String; // Detail (button, checkbox, ...)
Orientation: TGtkOrientation; // Orientation (horizontal/vertical)
ArrowType : TGtkArrowType; // type of arrow
Fill : Boolean; // fill inside area
GapSide : TGtkPositionType;//
GapX : gint;
GapWidth : gint;
MaxWidth : gint; // max area width
{$ifdef gtk2}
Expander : TGtkExpanderStyle; // treeview expander
ExpanderSize: Integer;
Edge : TGdkWindowEdge;
{$endif}
IsHot : Boolean;
end;
{ TGtk1ThemeServices }
{ TGtkThemeServices }
TGtkThemeServices = class(TThemeServices)
private
protected
procedure DrawPixmap(DC: HDC; Area: PGdkRectangle; PixmapIndex: Byte); virtual;
function GetParamsCount(Details: TThemedElementDetails): Integer; virtual;
function GetGtkStyleParams(DC: HDC; Details: TThemedElementDetails; AIndex: Integer): TGtkStyleParams; virtual;
function InitThemes: Boolean; override;
function UseThemes: Boolean; override;
function ThemedControlsEnabled: Boolean; override;
procedure InternalDrawParentBackground(Window: HWND; Target: HDC; Bounds: PRect); override;
function GetBaseDetailsSize(Details: TThemedElementDetails): TSize;
public
function GetDetailSize(Details: TThemedElementDetails): TSize; override;
procedure DrawElement(DC: HDC; Details: TThemedElementDetails; const R: TRect; ClipRect: PRect); override;
procedure DrawIcon(DC: HDC; Details: TThemedElementDetails; const R: TRect; himl: HIMAGELIST; Index: Integer); override;
procedure DrawText(DC: HDC; Details: TThemedElementDetails; const S: String; R: TRect; Flags, Flags2: Cardinal); override;
function ContentRect(DC: HDC; Details: TThemedElementDetails; BoundingRect: TRect): TRect; override;
function HasTransparentParts(Details: TThemedElementDetails): Boolean; override;
end;
const
// most common maps
GtkButtonMap: array[0..6] of TGtkStateType =
(
{ filter ? } GTK_STATE_NORMAL,
{ normal } GTK_STATE_NORMAL,
{ hot } GTK_STATE_PRELIGHT,
{ pressed } GTK_STATE_ACTIVE,
{ disabled } GTK_STATE_INSENSITIVE,
{ defaulted/checked } GTK_STATE_ACTIVE,
{ hot + checked } GTK_STATE_ACTIVE
);
GtkRadioCheckBoxMap: array[0..12] of TGtkStateType =
(
{ Filler } GTK_STATE_NORMAL,
{ UNCHECKEDNORMAL } GTK_STATE_NORMAL,
{ UNCHECKEDHOT } GTK_STATE_PRELIGHT,
{ UNCHECKEDPRESSED } GTK_STATE_ACTIVE,
{ UNCHECKEDDISABLED } GTK_STATE_INSENSITIVE,
{ CHECKEDNORMAL } GTK_STATE_NORMAL,
{ CHECKEDHOT } GTK_STATE_PRELIGHT,
{ CHECKEDPRESSED } GTK_STATE_ACTIVE,
{ CHECKEDDISABLED } GTK_STATE_INSENSITIVE,
{ MIXEDNORMAL } GTK_STATE_NORMAL,
{ MIXEDHOT } GTK_STATE_PRELIGHT,
{ MIXEDPRESSED } GTK_STATE_ACTIVE,
{ MIXEDDISABLED } GTK_STATE_INSENSITIVE
);
GtkTitleButtonMap: array[0..5] of TGtkStateType =
(
{ filter ? } GTK_STATE_NORMAL,
{ normal } GTK_STATE_NORMAL,
{ hot } GTK_STATE_PRELIGHT,
{ pressed } GTK_STATE_ACTIVE,
{ disabled } GTK_STATE_INSENSITIVE,
{ inactive } GTK_STATE_INSENSITIVE
);
implementation
{$I gtkstdpixmaps.inc}
{ TGtkThemeServices }
procedure TGtkThemeServices.DrawPixmap(DC: HDC; Area: PGdkRectangle; PixmapIndex: Byte);
var
APixmap, APixmapMask: PGdkPixmap;
DevCtx: TGtkDeviceContext absolute DC;
w, h: gint;
begin
if (PixmapIndex >= Low(PixmapArray)) and (PixmapIndex <= High(PixmapArray)) then
begin
APixmapMask := nil;
APixmap := gdk_pixmap_create_from_xpm_d(DevCtx.Drawable,
APixmapMask, nil, PixmapArray[PixmapIndex]);
if APixmap <> nil then
begin
gdk_drawable_get_size(APixmap, @w, @h);
w := (Area^.Width - w) div 2;
if w < 0 then
w := 0;
h := (Area^.Height - h) div 2;
if h < 0 then
h := 0;
if APixmapMask <> nil then
begin
gdk_gc_set_clip_mask(DevCtx.GC, APixmapMask);
gdk_gc_set_clip_origin(DevCtx.GC, Area^.x + w, Area^.y + h);
end;
gdk_draw_pixmap(DevCtx.Drawable, DevCtx.GC, APixmap, 0, 0, Area^.x + w, Area^.y + h,
Area^.Width, Area^.Height);
if APixmapMask <> nil then
DevCtx.ResetGCClipping;
gdk_pixmap_unref(APixmap);
end;
if APixmapMask <> nil then
gdk_pixmap_unref(APixmapMask);
end;
end;
function TGtkThemeServices.GetParamsCount(Details: TThemedElementDetails): Integer;
begin
Result := 1;
if (Details.Element = teToolBar) and (Details.Part = TP_SPLITBUTTONDROPDOWN) then
inc(Result); // + Arrow
end;
function TGtkThemeServices.GetGtkStyleParams(DC: HDC;
Details: TThemedElementDetails; AIndex: Integer): TGtkStyleParams;
var
DevCtx: TGtkDeviceContext absolute DC;
ClientWidget: PGtkWidget;
begin
FillByte(Result, SizeOf(Result), 0);
if not GTKWidgetSet.IsValidDC(DC) then Exit;
Result.Widget := DevCtx.Widget;
if Result.Widget <> nil then
begin
ClientWidget := GetFixedWidget(Result.Widget);
if ClientWidget <> nil then
Result.Widget := ClientWidget;
Result.Style := gtk_widget_get_style(Result.Widget);
end;
Result.Window := DevCtx.Drawable;
Result.Origin := DevCtx.Offset;
Result.Painter := gptDefault;
Result.State := GTK_STATE_NORMAL;
Result.Detail := '';
Result.Shadow := GTK_SHADOW_NONE;
Result.ArrowType := GTK_ARROW_UP;
Result.Fill := False;
Result.IsHot := False;
Result.GapSide := GTK_POS_LEFT;
Result.GapWidth := 0;
Result.GapX := 0;
Result.MaxWidth := 0;
case Details.Element of
teButton:
begin
case Details.Part of
BP_PUSHBUTTON:
begin
Result.Widget := GetStyleWidget(lgsButton);
if Result.Style = nil then
Result.Style := GetStyle(lgsButton);
Result.State := GtkButtonMap[Details.State];
if Details.State = PBS_PRESSED then
Result.Shadow := GTK_SHADOW_IN
else
Result.Shadow := GTK_SHADOW_OUT;
Result.IsHot:= Result.State = GTK_STATE_PRELIGHT;
Result.Detail := 'button';
Result.Painter := gptBox;
end;
BP_RADIOBUTTON:
begin
Result.Widget := GetStyleWidget(lgsRadiobutton);
if Result.Style = nil then
Result.Style := GetStyle(lgsRadiobutton);
Result.State := GtkRadioCheckBoxMap[Details.State];
if Details.State >= RBS_CHECKEDNORMAL then
Result.Shadow := GTK_SHADOW_IN
else
Result.Shadow := GTK_SHADOW_OUT;
Result.Detail := 'radiobutton';
Result.Painter := gptOption;
end;
BP_CHECKBOX:
begin
Result.Widget := GetStyleWidget(lgsCheckbox);
if Result.Style = nil then
Result.Style := GetStyle(lgsCheckbox);
Result.State := GtkRadioCheckBoxMap[Details.State];
Result.Detail := 'checkbutton';
if Details.State >= CBS_MIXEDNORMAL then
result.Shadow := GTK_SHADOW_ETCHED_IN
else
if Details.State >= CBS_CHECKEDNORMAL then
Result.Shadow := GTK_SHADOW_IN
else
Result.Shadow := GTK_SHADOW_OUT;
Result.Painter := gptCheck;
end;
end;
end;
teHeader:
begin
Result.Widget := GetStyleWidget(lgsButton);
if Result.Style = nil then
Result.Style := GetStyle(lgsButton);
Result.State := GtkButtonMap[Details.State];
if Details.State = PBS_PRESSED then
Result.Shadow := GTK_SHADOW_IN
else
Result.Shadow := GTK_SHADOW_OUT;
Result.IsHot := Result.State = GTK_STATE_PRELIGHT;
Result.Detail := 'button';
Result.Painter := gptBox;
end;
teStatus:
begin
Result.Widget := GetStyleWidget(lgsStatusBar);
if Result.Style = nil then
Result.Style := GetStyle(lgsStatusBar);
Result.Detail := 'statubar';
Result.State := GTK_STATE_NORMAL;
case Details.Part of
SP_PANE:
begin
Result.Painter := gptShadow;
Result.Shadow := GTK_SHADOW_OUT;
end;
SP_GRIPPER:
begin
Result.Painter := gptResizeGrip;
{$IFDEF Gtk2}
Result.Edge := GDK_WINDOW_EDGE_SOUTH_EAST;
{$ELSE}
Result.Shadow := GTK_SHADOW_IN;
{$ENDIF}
end;
end;
end;
teToolBar:
begin
case Details.Part of
TP_BUTTON,
TP_DROPDOWNBUTTON,
TP_SPLITBUTTON,
TP_SPLITBUTTONDROPDOWN:
begin
if (Details.Part = TP_SPLITBUTTONDROPDOWN) and (AIndex = 1) then
begin
Result.Detail := 'arrow';
Result.ArrowType := GTK_ARROW_DOWN;
Result.Fill := True;
Result.Painter := gptArrow;
Result.MaxWidth := 10;
end
else
begin
Result.Widget := GetStyleWidget(lgsToolButton);
if Result.Style = nil then
Result.Style := GetStyle(lgsToolButton);
Result.State := GtkButtonMap[Details.State];
if Details.State in [TS_PRESSED, TS_CHECKED, TS_HOTCHECKED] then
Result.Shadow := GTK_SHADOW_IN
else
if Details.State in [TS_HOT] then
Result.Shadow := GTK_SHADOW_ETCHED_IN
else
Result.Shadow := GTK_SHADOW_NONE;
Result.IsHot := Details.State in [TS_HOT, TS_HOTCHECKED];
Result.Detail := 'button';
if Result.Shadow = GTK_SHADOW_NONE then
Result.Painter := gptNone
else
Result.Painter := gptBox;
end;
end;
TP_SEPARATOR,
TP_SEPARATORVERT:
begin
Result.State := GTK_STATE_NORMAL;
Result.Shadow := GTK_SHADOW_NONE;
Result.Detail := 'toolbar';
if Details.Part = TP_SEPARATOR then
Result.Painter := gptVLine
else
Result.Painter := gptHLine;
end;
end;
end;
teRebar:
begin
case Details.Part of
RP_GRIPPER, RP_GRIPPERVERT:
begin
Result.State := GTK_STATE_NORMAL;
Result.Shadow := GTK_SHADOW_NONE;
{ This code has problems with some (is not most) of gtk1 themes.
But at least Ubuntu >= 6.10 works fine. So it is commented out and switched
to alternate splitter painting}
if Details.Part = RP_GRIPPER then
begin
Result.Detail := 'hpaned';
Result.Widget := GetStyleWidget(lgsHorizontalPaned);
if Result.Style = nil then
Result.Style := GetStyle(lgsHorizontalPaned);
end
else
begin
Result.Detail := 'vpaned';
Result.Widget := GetStyleWidget(lgsVerticalPaned);
if Result.Style = nil then
Result.Style := GetStyle(lgsVerticalPaned);
end;
Result.Painter := gptBox;
{ Result.Detail := 'paned';
Result.Painter := gptHandle;
if Details.Part = RP_GRIPPER then
Result.Orientation := GTK_ORIENTATION_VERTICAL
else
Result.Orientation := GTK_ORIENTATION_HORIZONTAL;}
end;
RP_BAND:
begin
Result.State := GtkButtonMap[Details.State];
Result.Shadow := GTK_SHADOW_NONE;
Result.Detail := 'paned';
Result.Painter := gptFlatBox;
end;
end;
end;
teWindow:
begin
if Details.Part in [WP_MDIMINBUTTON, WP_MDIRESTOREBUTTON, WP_MDICLOSEBUTTON] then
begin
Result.State := GtkTitleButtonMap[Details.State];
Result.Shadow := GTK_SHADOW_NONE;
case Details.Part of
WP_MDIMINBUTTON: Result.Detail := #1;
WP_MDIRESTOREBUTTON: Result.Detail := #2;
WP_MDICLOSEBUTTON: Result.Detail := #3;
end;
Result.Painter := gptPixmap;
end;
end;
teTab:
begin
Result.Widget := GetStyleWidget(lgsNotebook);
if Result.Style = nil then
Result.Style := GetStyle(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 := gptBox;
end;
end;
teToolTip:
begin
Result.Style := GetStyle(lgsTooltip);
Result.Widget := GetStyleWidget(lgsTooltip);
Result.State := GTK_STATE_NORMAL;
Result.Shadow := GTK_SHADOW_OUT;
Result.Detail := 'tooltip';
if Details.Part = TTP_STANDARD then
Result.Painter := gptFlatBox;
end;
end;
if Result.Style = nil then
Result.Style := gtk_widget_get_default_style();
end;
function TGtkThemeServices.InitThemes: Boolean;
begin
Result := True;
end;
function TGtkThemeServices.UseThemes: Boolean;
begin
Result := True;
end;
function TGtkThemeServices.ThemedControlsEnabled: Boolean;
begin
Result := True;
end;
function TGtkThemeServices.ContentRect(DC: HDC;
Details: TThemedElementDetails; BoundingRect: TRect): TRect;
var
StyleParams: TGtkStyleParams;
begin
Result := BoundingRect;
StyleParams := GetGtkStyleParams(DC, Details, 0);
if StyleParams.Style <> nil then
InflateRect(Result,
-StyleParams.Style^.{$ifndef gtk2}klass^.{$endif}xthickness,
-StyleParams.Style^.{$ifndef gtk2}klass^.{$endif}ythickness);
end;
procedure TGtkThemeServices.DrawElement(DC: HDC;
Details: TThemedElementDetails; const R: TRect; ClipRect: PRect);
var
DevCtx: TGtkDeviceContext absolute DC;
Area: TGdkRectangle;
StyleParams: TGtkStyleParams;
i: integer;
RDest: TRect;
begin
if IsRectEmpty(R) then
Exit;
for i := 0 to GetParamsCount(Details) - 1 do
begin
StyleParams := GetGtkStyleParams(DC, Details, i);
if StyleParams.Style <> nil then
begin
if DevCtx.HasTransf then
begin
if ClipRect <> nil then RDest := ClipRect^ else RDest := R;
RDest := DevCtx.TransfRectIndirect(R);
DevCtx.TransfNormalize(RDest.Left, RDest.Right);
DevCtx.TransfNormalize(RDest.Top, RDest.Bottom);
Area := GdkRectFromRect(RDest);
end
else if ClipRect <> nil then
Area := GdkRectFromRect(ClipRect^)
else
Area := GdkRectFromRect(R);
// move to origin
inc(Area.x, StyleParams.Origin.x);
inc(Area.y, StyleParams.Origin.y);
with StyleParams do
begin
{$ifndef gtk1}
if Painter = gptExpander then
begin
// Better to draw expander with the ExpanderSize, but sometimes it
// will not look very well. The best can we do is to use the same odd/even
// amount of pixels => expand/shrink area.width and area.height a bit
// Area.width := ExpanderSize;
if Odd(Area.width) <> Odd(ExpanderSize) then
if Area.width < ExpanderSize then
inc(Area.width)
else
dec(Area.width);
// Area.height := ExpanderSize;
if Odd(Area.height) <> Odd(ExpanderSize) then
if Area.height < ExpanderSize then
inc(Area.height)
else
dec(Area.height);
end;
{$endif}
if (MaxWidth <> 0) then
begin
if Area.width > MaxWidth then
begin
inc(Area.x, (Area.width - MaxWidth) div 2);
Area.width := MaxWidth;
end;
end;
case Painter of
gptDefault: inherited DrawElement(DC, Details, R, ClipRect);
gptBox:
gtk_paint_box(
Style, Window,
State, Shadow,
@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,
Widget, PChar(Detail),
Area.x, Area.x + Area.Width, Area.y);
gptVLine : gtk_paint_vline(
Style, Window,
State, @Area,
Widget, PChar(Detail),
Area.y, Area.y + Area.Height, Area.x);
gptShadow : gtk_paint_shadow(
Style, Window,
State, Shadow,
@Area, Widget, PChar(Detail),
Area.x, Area.y,
Area.Width, Area.Height);
gptFlatBox: gtk_paint_flat_box(
Style, Window,
State, Shadow,
@Area, Widget, PChar(Detail),
Area.x, Area.y,
Area.Width, Area.Height);
gptCheck : gtk_paint_check(
Style, Window,
State, Shadow,
@Area, Widget, PChar(Detail),
Area.x, Area.y,
Area.Width, Area.Height);
gptOption : gtk_paint_option(
Style, Window,
State, Shadow,
@Area, Widget, PChar(Detail),
Area.x, Area.y,
Area.Width, Area.Height);
gptTab : gtk_paint_tab(
Style, Window,
State, Shadow,
@Area, Widget, PChar(Detail),
Area.x, Area.y,
Area.Width, Area.Height);
gptSlider : gtk_paint_slider(
Style, Window,
State, Shadow,
@Area, Widget, PChar(Detail),
Area.x, Area.y,
Area.Width, Area.Height,
Orientation);
gptHandle : gtk_paint_handle(
Style, Window,
State, Shadow,
@Area, Widget, PChar(Detail),
Area.x, Area.y,
Area.Width, Area.Height,
Orientation);
{$ifdef gtk2}
gptExpander: gtk_paint_expander(
Style, Window, State,
@Area, Widget, PChar(Detail),
Area.x + Area.width shr 1, Area.y + Area.height shr 1,
Expander);
gptResizeGrip: gtk_paint_resize_grip(
Style, Window, State,
@Area, Widget,
PChar(Detail), Edge,
Area.x, Area.y,
Area.Width, Area.Height);
{$endif}
gptFocus : gtk_paint_focus(
Style, Window, {$ifdef gtk2}State,{$endif}
@Area, Widget, PChar(Detail),
Area.x, Area.y,
Area.Width, Area.Height);
gptArrow: gtk_paint_arrow(
Style, Window,
State, Shadow,
@Area, Widget, PChar(Detail),
ArrowType, Fill,
Area.x, Area.y, Area.width, Area.height
);
gptPixmap: DrawPixmap(DC, @Area, Ord(Detail[1]));
end;
end;
end;
end;
end;
procedure TGtkThemeServices.DrawIcon(DC: HDC;
Details: TThemedElementDetails; const R: TRect; himl: HIMAGELIST;
Index: Integer);
begin
end;
function TGtkThemeServices.HasTransparentParts(Details: TThemedElementDetails): Boolean;
begin
Result := True; // ?
end;
procedure TGtkThemeServices.InternalDrawParentBackground(Window: HWND;
Target: HDC; Bounds: PRect);
begin
// ?
end;
function TGtkThemeServices.GetBaseDetailsSize(Details: TThemedElementDetails): TSize;
begin
Result := inherited GetDetailSize(Details);
end;
function TGtkThemeServices.GetDetailSize(Details: TThemedElementDetails): TSize;
begin
case Details.Element of
teRebar :
if Details.Part in [RP_GRIPPER, RP_GRIPPERVERT] then
Result := Size(-1, -1);
else
Result := GetBaseDetailsSize(Details);
end;
end;
procedure TGtkThemeServices.DrawText(DC: HDC; Details: TThemedElementDetails;
const S: String; R: TRect; Flags, Flags2: Cardinal);
var
StyleParams: TGtkStyleParams;
P: PChar;
tmpRect: TRect;
begin
StyleParams := GetGtkStyleParams(DC, Details, 0);
if StyleParams.Style <> nil then
with StyleParams do
begin
P := PChar(S);
tmpRect := R;
Widgetset.DrawText(DC, P, Length(S), tmpRect, Flags);
// TODO: parse flags
//gtk_draw_string(Style, Window, State, R.Left + Origin.x, R.Top + Origin.y, P);
end;
end;
end.
|