mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 13:59:31 +02:00
gtk:
- add MDI button pixmaps (new inc file) - teach gtk theme engine to draw pixmaps - cleanup git-svn-id: trunk@13651 -
This commit is contained in:
parent
73c65abe50
commit
3d441b5758
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2988,6 +2988,7 @@ lcl/interfaces/gtk/gtkpagecallback.inc svneol=native#text/pascal
|
||||
lcl/interfaces/gtk/gtkprivatewidget.inc svneol=native#text/plain
|
||||
lcl/interfaces/gtk/gtkproc.inc svneol=native#text/pascal
|
||||
lcl/interfaces/gtk/gtkproc.pp svneol=native#text/pascal
|
||||
lcl/interfaces/gtk/gtkstdpixmaps.inc svneol=native#text/pascal
|
||||
lcl/interfaces/gtk/gtkthemes.pas svneol=native#text/pascal
|
||||
lcl/interfaces/gtk/gtkwidgetset.inc svneol=native#text/pascal
|
||||
lcl/interfaces/gtk/gtkwinapi.inc svneol=native#text/pascal
|
||||
|
@ -52,8 +52,8 @@ var
|
||||
//TrashCan_Open_Mask : PGdkPixmap;
|
||||
//TrashCan_Closed : PGdkPixmap;
|
||||
//TrashCan_Closed_Mask : PGdkPixmap;
|
||||
Drag_Icon : PgdkPixmap;
|
||||
Drag_Mask : PgdkPixmap;
|
||||
//Drag_Icon : PgdkPixmap;
|
||||
//Drag_Mask : PgdkPixmap;
|
||||
|
||||
//Dragging : Boolean;
|
||||
|
||||
|
64
lcl/interfaces/gtk/gtkstdpixmaps.inc
Normal file
64
lcl/interfaces/gtk/gtkstdpixmaps.inc
Normal file
@ -0,0 +1,64 @@
|
||||
{%MainUnit gtkthemes.pas}
|
||||
|
||||
const
|
||||
XPM_MDIRESTOREBUTTON: array[0..12] of PChar =
|
||||
(
|
||||
'10 10 2 1',
|
||||
' g None',
|
||||
'. g #000000',
|
||||
' ',
|
||||
' .......',
|
||||
' .......',
|
||||
' . .',
|
||||
' ....... .',
|
||||
' ....... .',
|
||||
' . ...',
|
||||
' . . ',
|
||||
' . . ',
|
||||
' ....... '
|
||||
);
|
||||
|
||||
XPM_MDICLOSEBUTTON: array[0..12] of PChar =
|
||||
(
|
||||
'10 10 2 1',
|
||||
' g None',
|
||||
'. g #000000',
|
||||
' ',
|
||||
' .. .. ',
|
||||
' ... ... ',
|
||||
' ...... ',
|
||||
' .... ',
|
||||
' .... ',
|
||||
' ...... ',
|
||||
' ... ... ',
|
||||
' .. .. ',
|
||||
' '
|
||||
);
|
||||
|
||||
XPM_MDIMINBUTTON: array[0..12] of PChar =
|
||||
(
|
||||
'10 10 2 1',
|
||||
' g None',
|
||||
'. g #000000',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ...... ',
|
||||
' ...... ',
|
||||
' '
|
||||
);
|
||||
|
||||
var
|
||||
PixmapArray: array[1..3] of PPgchar =
|
||||
(
|
||||
{1 - MDIMINBUTTON}
|
||||
@XPM_MDIMINBUTTON,
|
||||
{2 - MDIRESTOREBUTTON}
|
||||
@XPM_MDIRESTOREBUTTON,
|
||||
{3 - MDICLOSEBUTTON}
|
||||
@XPM_MDICLOSEBUTTON
|
||||
);
|
@ -36,7 +36,8 @@ type
|
||||
gptExpander,
|
||||
gptResizeGrip,
|
||||
gptFocus,
|
||||
gptArrow
|
||||
gptArrow,
|
||||
gptPixmap
|
||||
);
|
||||
|
||||
TGtkStyleParams = record
|
||||
@ -65,6 +66,8 @@ type
|
||||
TGtkThemeServices = class(TThemeServices)
|
||||
private
|
||||
protected
|
||||
procedure DrawPixmap(DC: HDC; Area: PGdkRectangle; PixmapIndex: Byte); virtual;
|
||||
|
||||
function GdkRectFromRect(R: TRect): TGdkRectangle;
|
||||
function GetParamsCount(Details: TThemedElementDetails): Integer;
|
||||
function GetGtkStyleParams(DC: HDC; Details: TThemedElementDetails; AIndex: Integer): TGtkStyleParams; virtual;
|
||||
@ -114,12 +117,50 @@ const
|
||||
{ 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;
|
||||
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
|
||||
if APixmapMask <> nil then
|
||||
begin
|
||||
gdk_gc_set_clip_mask(DevCtx.GC, APixmapMask);
|
||||
gdk_gc_set_clip_origin(DevCtx.GC, Area^.x, Area^.y);
|
||||
end;
|
||||
gdk_draw_drawable(DevCtx.Drawable, DevCtx.GC, APixmap, 0, 0, Area^.x, Area^.y,
|
||||
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.GdkRectFromRect(R: TRect): TGdkRectangle;
|
||||
begin
|
||||
with Result, R do
|
||||
@ -312,6 +353,20 @@ to alternate splitter painting}
|
||||
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;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -453,6 +508,7 @@ begin
|
||||
ArrowType, Fill,
|
||||
Area.x, Area.y, Area.width, Area.height
|
||||
);
|
||||
gptPixmap: DrawPixmap(DC, @Area, Ord(Detail[1]));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -322,16 +322,6 @@ begin
|
||||
// the clipboard needs a widget
|
||||
if (ClipboardWidget = nil) then
|
||||
GtkWidgetSet.SetClipboardWidget(P);
|
||||
|
||||
//drag icons
|
||||
if Drag_Icon = nil then
|
||||
begin
|
||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||
Drag_Icon := gdk_pixmap_colormap_create_from_xpm_d (nil,
|
||||
gtk_widget_get_colormap (P), Drag_Mask,
|
||||
nil, @IMGDrag_Icon[0]);
|
||||
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
@ -1273,7 +1273,7 @@ end;
|
||||
NOTE: This function is mapped to DrawEdge on Windows.
|
||||
------------------------------------------------------------------------------}
|
||||
function TWin32WidgetSet.Frame3D(DC: HDC; var Rect: TRect;
|
||||
Const FrameWidth: Integer; Const Style: TBevelCut): Boolean;
|
||||
const FrameWidth: Integer; const Style: TBevelCut): Boolean;
|
||||
const
|
||||
Edge: array[TBevelCut] of Integer =
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user