mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-02-19 19:36:32 +01:00
* Implemented LCL side of imagelist * restructured rawimage to more OO Merged revisions 11289-11617 via svnmerge from http://svn.freepascal.org/svn/lazarus/branches/marc-lcl ........ r11289 | marc | 2007-06-06 22:50:05 +0200 (Wed, 06 Jun 2007) | 1 line private branch for bitmap rework ........ r11290 | marc | 2007-06-06 23:30:09 +0200 (Wed, 06 Jun 2007) | 2 lines * Initial linux and win32 implementation ........ r11291 | paul | 2007-06-07 03:20:11 +0200 (Thu, 07 Jun 2007) | 3 lines - fix compilation with fpc 2.3.1 - remove unneded code for converting cursor mask - enabled loading of standard windows status icons instead of LCL ........ r11292 | paul | 2007-06-07 11:03:27 +0200 (Thu, 07 Jun 2007) | 1 line - some bugs with mask and alpha ........ r11299 | marc | 2007-06-08 00:59:26 +0200 (Fri, 08 Jun 2007) | 2 lines * force alpha channel when PNG has alpha ........ r11302 | paul | 2007-06-09 04:45:12 +0200 (Sat, 09 Jun 2007) | 1 line - fix black rectangles instead of manu item images ........ r11303 | paul | 2007-06-09 04:46:14 +0200 (Sat, 09 Jun 2007) | 1 line formatting ........ r11309 | marc | 2007-06-11 02:25:07 +0200 (Mon, 11 Jun 2007) | 3 lines * Added alpha premultiply * Published Colorbox selection property ........ r11310 | paul | 2007-06-11 19:10:18 +0200 (Mon, 11 Jun 2007) | 1 line misc ........ r11312 | marc | 2007-06-12 01:44:03 +0200 (Tue, 12 Jun 2007) | 2 lines * start with carbon ........ r11313 | paul | 2007-06-12 14:02:48 +0200 (Tue, 12 Jun 2007) | 1 line - BitBtn glyph transparency ........ r11315 | paul | 2007-06-13 05:20:40 +0200 (Wed, 13 Jun 2007) | 1 line - problems with internal bitmap saving/loading (is was 24bpp when 32bpp needed) ........ r11319 | paul | 2007-06-14 06:32:04 +0200 (Thu, 14 Jun 2007) | 1 line - More LCL way of painting images through ThemeServices ........ r11320 | paul | 2007-06-14 06:32:56 +0200 (Thu, 14 Jun 2007) | 1 line - ability to override bitbtn glyph to nothing ........ r11321 | paul | 2007-06-14 06:34:49 +0200 (Thu, 14 Jun 2007) | 1 line painting headercontrol images through ThemeServices ........ r11325 | paul | 2007-06-17 10:14:27 +0200 (Sun, 17 Jun 2007) | 1 line fixing painting of 32bpp bitmaps with no Alpha ........ r11326 | paul | 2007-06-17 10:16:00 +0200 (Sun, 17 Jun 2007) | 1 line missed file ........ r11337 | paul | 2007-06-20 03:44:47 +0200 (Wed, 20 Jun 2007) | 3 lines - revert previous commit - create 24bpp bitmaps by default ........ r11342 | marc | 2007-06-21 01:47:30 +0200 (Thu, 21 Jun 2007) | 3 lines * Added Alpha support on Carbon * Simplified win32 rawimage_fromdevice ........ r11343 | paul | 2007-06-21 04:36:28 +0200 (Thu, 21 Jun 2007) | 1 line - adopt gtk2 code ........ r11344 | paul | 2007-06-21 04:41:41 +0200 (Thu, 21 Jun 2007) | 1 line make gtk2 work ........ r11353 | paul | 2007-06-22 10:12:19 +0200 (Fri, 22 Jun 2007) | 1 line - default WS imagelist implementation ........ r11358 | marc | 2007-06-23 13:29:06 +0200 (Sat, 23 Jun 2007) | 2 lines * Implemented MaskBlit ........ r11359 | paul | 2007-06-23 20:02:52 +0200 (Sat, 23 Jun 2007) | 1 line draw new imagelist bitmap on widget canvas ........ r11371 | marc | 2007-06-25 23:50:13 +0200 (Mon, 25 Jun 2007) | 2 lines * Rawimage rework ........ r11372 | marc | 2007-06-25 23:51:00 +0200 (Mon, 25 Jun 2007) | 2 lines + Added header ........ r11373 | marc | 2007-06-26 00:05:55 +0200 (Tue, 26 Jun 2007) | 2 lines * Swapped RGBA <-> ARGB defualt format since most widgetsets use ARGB ........ r11374 | marc | 2007-06-26 00:09:36 +0200 (Tue, 26 Jun 2007) | 2 lines * added ........ r11462 | marc | 2007-07-12 00:16:02 +0200 (Thu, 12 Jul 2007) | 2 lines + added header ........ r11463 | marc | 2007-07-12 00:18:49 +0200 (Thu, 12 Jul 2007) | 2 lines * Added alpha/masked strechblt support ........ r11464 | marc | 2007-07-12 00:21:27 +0200 (Thu, 12 Jul 2007) | 2 lines * create DIBSection instead of DIBitmap ........ r11502 | marc | 2007-07-14 00:23:42 +0200 (Sat, 14 Jul 2007) | 2 lines * Fixed transparentcolor after loading bitmap ........ r11505 | marc | 2007-07-14 15:10:56 +0200 (Sat, 14 Jul 2007) | 2 lines - Removed ARGB dataconversion, internal format is by default the same now ........ r11531 | marc | 2007-07-17 01:23:34 +0200 (Tue, 17 Jul 2007) | 2 lines * changed TRawImage into object ........ r11533 | paul | 2007-07-17 05:10:31 +0200 (Tue, 17 Jul 2007) | 3 lines - change several occurrence of FillChar(..TRawImageDescription..) with call to Init - change imagelist defines to use old imagelist (new is crashes ide) - change TWin32ThemeServices to use old imagelist ........ r11534 | paul | 2007-07-17 05:19:02 +0200 (Tue, 17 Jul 2007) | 3 lines - change several occurrence of FillChar(..TRawImageDescription..) with call to Init in Qt widgetset - change TRawImageDescription.IsEqual and TRawImage.IsEqual ........ r11535 | paul | 2007-07-17 05:23:53 +0200 (Tue, 17 Jul 2007) | 1 line - change several occurrence of FillChar(..TRawImageDescription..) with call to Init in wince widgetset ........ r11554 | marc | 2007-07-18 00:10:11 +0200 (Wed, 18 Jul 2007) | 2 lines * fixed compilation on 2.0.4 ........ r11555 | marc | 2007-07-18 00:10:44 +0200 (Wed, 18 Jul 2007) | 2 lines * fixed compilation ........ r11556 | marc | 2007-07-18 00:11:43 +0200 (Wed, 18 Jul 2007) | 2 lines * fixed fillchar on TRawImage object ........ r11572 | marc | 2007-07-19 01:41:35 +0200 (Thu, 19 Jul 2007) | 2 lines * fixed crash when object has vmt ........ r11573 | marc | 2007-07-19 01:42:14 +0200 (Thu, 19 Jul 2007) | 2 lines * Made TRawimage compatible with record again ........ r11580 | marc | 2007-07-20 01:33:20 +0200 (Fri, 20 Jul 2007) | 2 lines * enabled newimagelist ........ r11581 | marc | 2007-07-20 01:33:48 +0200 (Fri, 20 Jul 2007) | 2 lines * fixed font ........ git-svn-id: trunk@11861 -
519 lines
16 KiB
PHP
519 lines
16 KiB
PHP
{%MainUnit gtkproc.pp}{%MainUnit gtkint.pp}
|
|
{ $Id$ }
|
|
{
|
|
*****************************************************************************
|
|
* *
|
|
* This file is part of the Lazarus Component Library (LCL) *
|
|
* *
|
|
* See the file COPYING.modifiedLGPL, included in this distribution, *
|
|
* for details about the copyright. *
|
|
* *
|
|
* This program is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
* *
|
|
*****************************************************************************
|
|
}
|
|
|
|
function G_OBJECT(p: Pointer): PGtkObject;
|
|
begin
|
|
Result:=PGtkObject(p);
|
|
end;
|
|
|
|
function G_CALLBACK(p: Pointer): TGTKSignalFunc;
|
|
begin
|
|
Result:=TGTKSignalFunc(p);
|
|
end;
|
|
|
|
function GDK_GET_CURRENT_DESKTOP(): gint;
|
|
var
|
|
XDisplay: PDisplay;
|
|
XScreen: PScreen;
|
|
XWindow: TWindow;
|
|
AtomType: x.TAtom;
|
|
Format: gint;
|
|
nitems: gulong;
|
|
bytes_after: gulong;
|
|
current_desktop: pguint;
|
|
begin
|
|
Result := -1;
|
|
|
|
xdisplay := gdk_display;
|
|
xscreen := XDefaultScreenOfDisplay(xdisplay);
|
|
xwindow := XRootWindowOfScreen(xscreen);
|
|
|
|
XGetWindowProperty (xdisplay, xwindow,
|
|
XInternAtom(xdisplay, '_NET_CURRENT_DESKTOP', false),
|
|
0, MaxInt, False, XA_CARDINAL, @atomtype, @format, @nitems,
|
|
@bytes_after, gpointer(@current_desktop));
|
|
|
|
if (atomtype = XA_CARDINAL) and (format = 32) and (nitems > 0) then
|
|
begin
|
|
Result := current_desktop[0];
|
|
XFree (current_desktop);
|
|
end;
|
|
end;
|
|
|
|
|
|
function GDK_WINDOW_GET_DESKTOP(Window: PGdkWindowPrivate): gint;
|
|
var
|
|
xdisplay: PDisplay;
|
|
xwindow: TWindow;
|
|
|
|
atomtype: x.TAtom;
|
|
format: gint;
|
|
nitems: gulong;
|
|
bytes_after: gulong;
|
|
current_desktop: pguint;
|
|
begin
|
|
Result := -1;
|
|
XWindow := GDK_WINDOW_XWINDOW (Window);
|
|
XDisplay := GDK_WINDOW_XDISPLAY (Window);
|
|
XGetWindowProperty (xdisplay, xwindow,
|
|
XInternAtom(xdisplay, '_NET_WM_DESKTOP', false),
|
|
0, MaxInt, False, XA_CARDINAL, @atomtype, @format, @nitems,
|
|
@bytes_after, gpointer(@current_desktop));
|
|
|
|
if (atomtype = XA_CARDINAL) and (format = 32) and (nitems > 0) then
|
|
begin
|
|
Result := current_desktop[0];
|
|
XFree (current_desktop);
|
|
end;
|
|
end;
|
|
|
|
function GDK_WINDOW_SET_DESKTOP(Window: PGdkWindowPrivate; Desktop: gint): gint;
|
|
var
|
|
XDisplay: PDisplay;
|
|
XScreen: PScreen;
|
|
XRootWindow,
|
|
XWindow: TWindow;
|
|
XEvent: TXClientMessageEvent;
|
|
_NET_WM_DESKTOP: Integer;
|
|
begin
|
|
|
|
Result := -1;
|
|
|
|
XDisplay := GDK_WINDOW_XDISPLAY (Window);
|
|
XScreen := XDefaultScreenOfDisplay(xdisplay);
|
|
XRootWindow := XRootWindowOfScreen(xscreen);
|
|
XWindow := GDK_WINDOW_XWINDOW (Window);
|
|
|
|
_NET_WM_DESKTOP := XInternAtom(xdisplay, '_NET_WM_DESKTOP', false);
|
|
|
|
XEvent._type := ClientMessage;
|
|
XEvent.window := XWindow;
|
|
XEvent.message_type := _NET_WM_DESKTOP;
|
|
XEvent.format := 32;
|
|
XEvent.data.l[0] := Desktop;
|
|
|
|
XSendEvent(XDisplay, XRootWindow, False, SubstructureNotifyMask, PXEvent(@XEvent));
|
|
end;
|
|
|
|
|
|
procedure GDK_WINDOW_ACTIVATE(Window: PGdkWindowPrivate);
|
|
var
|
|
XDisplay: PDisplay;
|
|
XScreen: PScreen;
|
|
aXRootWindow,
|
|
XWindow: x.TWindow;
|
|
XEvent: xlib.TXClientMessageEvent;
|
|
_NET_ACTIVE_WINDOW: Integer;
|
|
begin
|
|
if (Window=nil) or (gdk.destroyed(Window^)<>0) then exit;
|
|
|
|
XDisplay := GDK_WINDOW_XDISPLAY (Window);
|
|
if XDisplay=nil then exit;
|
|
XScreen := XDefaultScreenOfDisplay(xdisplay);
|
|
if XScreen=nil then exit;
|
|
aXRootWindow := XRootWindowOfScreen(xscreen);
|
|
if aXRootWindow=0 then exit;
|
|
XWindow := GDK_WINDOW_XWINDOW (Window);
|
|
if XWindow=0 then exit;
|
|
|
|
_NET_ACTIVE_WINDOW := XInternAtom(xdisplay, '_NET_ACTIVE_WINDOW', false);
|
|
|
|
XEvent._type := ClientMessage;
|
|
XEvent.window := XWindow;
|
|
XEvent.message_type := _NET_ACTIVE_WINDOW;
|
|
XEvent.format := 32;
|
|
XEvent.data.l[0] := 1; //Message is from program
|
|
XEvent.data.l[1] := CurrentTime;
|
|
XEvent.data.l[2] := 0; // Applications current active window
|
|
|
|
XSendEvent(XDisplay, aXRootWindow, False, SubstructureNotifyMask, PXEvent(@XEvent));
|
|
end;
|
|
|
|
procedure GDK_WINDOW_MAXIMIZE(Window: PGdkWindowPrivate);
|
|
const
|
|
_NET_WM_STATE_REMOVE = 0; // remove/unset property
|
|
_NET_WM_STATE_ADD = 1; // add/set property
|
|
_NET_WM_STATE_TOGGLE = 2; // toggle property
|
|
var
|
|
XDisplay: PDisplay;
|
|
XScreen: PScreen;
|
|
aXRootWindow,
|
|
XWindow: TWindow;
|
|
XEvent: TXClientMessageEvent;
|
|
_NET_WM_STATE,
|
|
_NET_WM_STATE_MAXIMIZED_VERT,
|
|
_NET_WM_STATE_MAXIMIZED_HORZ: Integer;
|
|
|
|
begin
|
|
XDisplay := GDK_WINDOW_XDISPLAY (Window);
|
|
XScreen := XDefaultScreenOfDisplay(xdisplay);
|
|
aXRootWindow := XRootWindowOfScreen(xscreen);
|
|
XWindow := GDK_WINDOW_XWINDOW (Window);
|
|
|
|
_NET_WM_STATE := XInternAtom(xdisplay, '_NET_WM_STATE', false);
|
|
_NET_WM_STATE_MAXIMIZED_VERT := XInternAtom(xdisplay, '_NET_WM_STATE_MAXIMIZED_VERT', false);
|
|
_NET_WM_STATE_MAXIMIZED_HORZ := XInternAtom(xdisplay, '_NET_WM_STATE_MAXIMIZED_HORZ', false);
|
|
|
|
XEvent._type := ClientMessage;
|
|
XEvent.window := XWindow;
|
|
XEvent.message_type := _NET_WM_STATE;
|
|
XEvent.format := 32;
|
|
XEvent.data.l[0] := _NET_WM_STATE_ADD;
|
|
XEvent.data.l[1] := _NET_WM_STATE_MAXIMIZED_HORZ;
|
|
XEvent.data.l[2] := _NET_WM_STATE_MAXIMIZED_VERT;
|
|
|
|
XSendEvent(XDisplay, aXRootWindow, False, SubstructureNotifyMask, PXEvent(@XEvent));
|
|
end;
|
|
|
|
|
|
|
|
procedure GDK_WINDOW_MINIMIZE(Window: PGdkWindowPrivate);
|
|
const
|
|
_NET_WM_STATE_REMOVE = 0; // remove/unset property
|
|
_NET_WM_STATE_ADD = 1; // add/set property
|
|
_NET_WM_STATE_TOGGLE = 2; // toggle property
|
|
var
|
|
XDisplay: PDisplay;
|
|
XScreen: PScreen;
|
|
XWindow: x.TWindow;
|
|
_NET_WM_STATE,
|
|
_NET_WM_STATE_HIDDEN: Integer;
|
|
atomtype: x.TAtom;
|
|
format: gint;
|
|
nitems: gulong;
|
|
bytes_after: gulong;
|
|
windowstates: Pcuchar;
|
|
X: Integer;
|
|
|
|
begin
|
|
XDisplay := GDK_WINDOW_XDISPLAY (Window);
|
|
XScreen := XDefaultScreenOfDisplay(xdisplay);
|
|
XWindow := GDK_WINDOW_XWINDOW (Window);
|
|
|
|
_NET_WM_STATE := XInternAtom(xdisplay, '_NET_WM_STATE', false);
|
|
_NET_WM_STATE_HIDDEN := XInternAtom(xdisplay, '_NET_WM_STATE_HIDDEN', false);
|
|
|
|
XGetWindowProperty (xdisplay, xwindow, _NET_WM_STATE ,
|
|
0, MaxInt, False, XA_CARDINAL, @atomtype, @format, @nitems,
|
|
@bytes_after, @windowstates);
|
|
if (atomtype = XA_CARDINAL) and (format = 32) and (nitems > 0) then
|
|
begin
|
|
// Check to see if the window is already minimized...
|
|
for X := 0 to nitems do begin
|
|
if windowstates[X] = _NET_WM_STATE_HIDDEN then begin
|
|
XFree (windowstates);
|
|
exit;
|
|
end;
|
|
end;
|
|
XFree (windowstates);
|
|
end;
|
|
|
|
XIconifyWindow(XDisplay, XWindow, XScreenNumberOfScreen(XScreen));
|
|
end;
|
|
|
|
function GDK_WINDOW_GET_MAXIMIZED(Window: PGdkWindowPrivate): gboolean;
|
|
var
|
|
xdisplay: PDisplay;
|
|
xwindow: TWindow;
|
|
|
|
atomtype: x.TAtom;
|
|
format: gint;
|
|
nitems: gulong;
|
|
bytes_after: gulong;
|
|
state_array: pguint;
|
|
_NET_WM_STATE,
|
|
_NET_WM_STATE_MAXIMIZED_VERT,
|
|
_NET_WM_STATE_MAXIMIZED_HORZ: x.TAtom;
|
|
X: Integer;
|
|
maximized_horz, maximized_vert: Boolean;
|
|
begin
|
|
Result := False;
|
|
XWindow := GDK_WINDOW_XWINDOW (Window);
|
|
XDisplay := GDK_WINDOW_XDISPLAY (Window);
|
|
|
|
_NET_WM_STATE := XInternAtom(xdisplay, '_NET_WM_STATE', false);
|
|
_NET_WM_STATE_MAXIMIZED_VERT := XInternAtom(xdisplay, '_NET_WM_STATE_MAXIMIZED_VERT', false);
|
|
_NET_WM_STATE_MAXIMIZED_HORZ := XInternAtom(xdisplay, '_NET_WM_STATE_MAXIMIZED_HORZ', false);
|
|
|
|
XGetWindowProperty (xdisplay, xwindow,
|
|
_NET_WM_STATE,
|
|
0, MaxInt, False, XA_ATOM, @atomtype, @format, @nitems,
|
|
@bytes_after, gpointer(@state_array));
|
|
|
|
if (atomtype = XA_ATOM) and (format = 32) and (nitems > 0) then
|
|
begin
|
|
maximized_horz := False;
|
|
maximized_vert := False;
|
|
for X := 0 to nitems-1 do begin
|
|
if (state_array[X] = _NET_WM_STATE_MAXIMIZED_VERT) then maximized_vert := True;
|
|
if (state_array[X] = _NET_WM_STATE_MAXIMIZED_HORZ) then maximized_horz := True;
|
|
Result:=(maximized_horz and maximized_vert);
|
|
|
|
if Result then Break;
|
|
end;
|
|
XFree (state_array);
|
|
end;
|
|
end;
|
|
|
|
procedure GDK_WINDOW_SHOW_IN_TASKBAR(Window: PGdkWindowPrivate; Show: Boolean);
|
|
// this is a try to hide windows from the taskbar.
|
|
// Unpleasantly, some windowmanagers like metacity also hides from the Alt-Tab
|
|
// cycle.
|
|
// This feature is therefore disabled on default.
|
|
{$IFDEF EnableHideFromTaskBar}
|
|
var
|
|
XDisplay: PDisplay;
|
|
XScreen: PScreen;
|
|
XRootWindow,
|
|
XWindow: TWindow;
|
|
XEvent: TXClientMessageEvent;
|
|
_NET_WM_STATE,
|
|
_NET_WM_STATE_SKIP_TASKBAR: clong;
|
|
{$ENDIF}
|
|
begin
|
|
{$IFDEF EnableHideFromTaskBar}
|
|
// GTK1: reshowing does not work, so a modal form will hide the whole application
|
|
// GTK
|
|
|
|
XDisplay := GDK_WINDOW_XDISPLAY (Window);
|
|
XScreen := XDefaultScreenOfDisplay(xdisplay);
|
|
XRootWindow := XRootWindowOfScreen(xscreen);
|
|
XWindow := GDK_WINDOW_XWINDOW (Window);
|
|
|
|
_NET_WM_STATE := XInternAtom(xdisplay, '_NET_WM_STATE', false);
|
|
_NET_WM_STATE_SKIP_TASKBAR := XInternAtom(xdisplay, '_NET_WM_STATE_SKIP_TASKBAR', false);
|
|
|
|
XEvent._type := ClientMessage;
|
|
XEvent.window := XWindow;
|
|
XEvent.message_type := _NET_WM_STATE;
|
|
XEvent.format := 32;
|
|
if Show then
|
|
XEvent.data.l[0] := 1
|
|
else
|
|
XEvent.data.l[0] := 0;// 0=Remove 1=Add 2=Toggle
|
|
XEvent.data.l[1] := _NET_WM_STATE_SKIP_TASKBAR;
|
|
|
|
XSendEvent(XDisplay, XRootWindow, False, SubstructureNotifyMask, @XEvent);
|
|
{$ENDIF}
|
|
end;
|
|
|
|
function gtk_class_get_type(aclass : Pointer) : TGtkType;
|
|
begin
|
|
If (aclass <> nil) then
|
|
result := PGtkTypeClass(aclass)^.thetype
|
|
else
|
|
result := 0;
|
|
end;
|
|
|
|
function gtk_object_get_class(anobject : Pointer) : Pointer;
|
|
begin
|
|
If (anobject <> nil) then
|
|
result := PGtkTypeObject(anobject)^.klass
|
|
else
|
|
result := nil;
|
|
end;
|
|
|
|
function gtk_window_get_modal(window:PGtkWindow):gboolean;
|
|
begin
|
|
if assigned(Window) then
|
|
result := (Window^.flag0 and bm_modal)<>0
|
|
else
|
|
result := False;
|
|
end;
|
|
|
|
function gtk_bin_get_child(bin : PGTKBin) : PGTKWidget;
|
|
begin
|
|
if (bin <> nil) then
|
|
result := bin^.Child
|
|
else
|
|
result := nil;
|
|
end;
|
|
|
|
procedure gtk_menu_item_set_right_justified(menu_item : PGtkMenuItem; right_justified : gboolean);
|
|
begin
|
|
if right_justified then
|
|
menu_item^.flag0:=menu_item^.flag0 or bm_right_justify
|
|
else
|
|
menu_item^.flag0:=menu_item^.flag0 and (not bm_right_justify);
|
|
end;
|
|
|
|
function gtk_check_menu_item_get_active(menu_item : PGtkCheckMenuItem) : gboolean;
|
|
begin
|
|
Result:=(menu_item^.flag0 and bm_checkmenuitem_active <> 0);
|
|
end;
|
|
|
|
procedure gtk_menu_append(menu : PGTKWidget; Item : PGtkWidget);
|
|
begin
|
|
gtk.gtk_menu_append(PGTKMenu(menu), Item);
|
|
end;
|
|
|
|
procedure gtk_menu_insert(menu : PGtkWidget; Item : PGTKWidget; Index : gint);
|
|
begin
|
|
gtk.gtk_menu_insert(PGTKMenu(menu), Item, Index);
|
|
end;
|
|
|
|
procedure gtk_menu_bar_insert(menubar : PGtkWidget; Item : PGTKWidget; Index : gint);
|
|
begin
|
|
gtk.gtk_menu_bar_insert(PGtkMenuBar(menubar), Item, Index);
|
|
end;
|
|
|
|
function gtk_image_new :PGTKWidget;
|
|
begin
|
|
result := gtk.gtk_image_new(nil,nil);
|
|
end;
|
|
|
|
function gtk_toolbar_new : PGTKWidget;
|
|
begin
|
|
result := gtk.gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,GTK_TOOLBAR_BOTH);
|
|
end;
|
|
|
|
procedure gtk_color_selection_get_current_color(colorsel : PGTKColorSelection; Color : PGDKColor);
|
|
var
|
|
colorArray : array[0..2] of double;
|
|
begin
|
|
gtk_color_selection_get_color(colorsel, @colorArray[0]);
|
|
Color^.pixel := 0;
|
|
Color^.red := gushort(TruncToCardinal(colorArray[0] * $FFFF));
|
|
Color^.green := gushort(TruncToCardinal(colorArray[1] * $FFFF));
|
|
Color^.blue := gushort(TruncToCardinal(colorArray[2] * $FFFF));
|
|
{$IFDEF VerboseColorDialog}
|
|
DebugLn('gtk_color_selection_get_current_color ',
|
|
' Red=',DbgS(Color^.Red),
|
|
' Green=',DbgS(Color^.Green),
|
|
' Blue=',DbgS(Color^.Blue),
|
|
'');
|
|
{$ENDIF}
|
|
end;
|
|
|
|
procedure gtk_color_selection_set_current_color(colorsel : PGTKColorSelection;
|
|
Color : PGDKColor);
|
|
var
|
|
SelectionColor: PGDouble;
|
|
begin
|
|
{$IFDEF VerboseColorDialog}
|
|
DebugLn('gtk_color_selection_set_current_color ',
|
|
' Red=',DbgS(Color^.Red),
|
|
' Green=',DbgS(Color^.Green),
|
|
' Blue=',DbgS(Color^.Blue),
|
|
'');
|
|
{$ENDIF}
|
|
GetMem(SelectionColor,4*SizeOf(GDouble));
|
|
try
|
|
SelectionColor[0]:=gdouble(Color^.Red)/65535;
|
|
SelectionColor[1]:=gdouble(Color^.Green)/65535;
|
|
SelectionColor[2]:=gdouble(Color^.Blue)/65535;
|
|
SelectionColor[3]:=0.0;
|
|
gtk_color_selection_set_color(colorSel,SelectionColor);
|
|
finally
|
|
FreeMem(SelectionColor);
|
|
end;
|
|
end;
|
|
|
|
procedure gdk_image_unref(Image : PGdkImage);
|
|
begin
|
|
gdk_window_unref(PGdkWindow(Image));
|
|
end;
|
|
|
|
procedure gdk_colormap_query_color(colormap : PGDKColormap; Pixel : gulong; Result : PGDKColor);
|
|
var
|
|
GdkColorContext: PGdkColorContext;
|
|
begin
|
|
if (Colormap = nil) or (Result = nil) then exit;
|
|
GdkColorContext:= gdk_color_context_new(gdk_colormap_get_visual(colormap),colormap);
|
|
Result^.Pixel := Pixel;
|
|
gdk_color_context_query_color(GdkColorContext, Result);
|
|
gdk_color_context_free(GdkColorContext);
|
|
end;
|
|
|
|
function gdk_region_intersect(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
|
begin
|
|
result := gdk_regions_intersect(source1, source2);
|
|
end;
|
|
|
|
function gdk_region_union(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
|
begin
|
|
result := gdk_regions_union(source1, source2);
|
|
end;
|
|
|
|
function gdk_region_subtract(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
|
begin
|
|
result := gdk_regions_subtract(source1, source2);
|
|
end;
|
|
|
|
function gdk_region_xor(source1:PGdkRegion; source2:PGdkRegion) : PGdkRegion;
|
|
begin
|
|
result := gdk_regions_xor(source1, source2);
|
|
end;
|
|
|
|
function gdk_region_copy(region: PGDKRegion): PGDKRegion;
|
|
var
|
|
EmptyRegion: PGdkRegion;
|
|
begin
|
|
EmptyRegion := gdk_region_new;
|
|
Result := gdk_regions_union(region, EmptyRegion);
|
|
gdk_region_destroy(EmptyRegion);
|
|
end;
|
|
|
|
function gdk_region_rectangle(rect: PGdkRectangle): PGDKRegion;
|
|
var
|
|
EmptyRegion: PGdkRegion;
|
|
begin
|
|
EmptyRegion := gdk_region_new;
|
|
Result := gdk_region_union_with_rect(EmptyRegion,Rect);
|
|
gdk_region_destroy(EmptyRegion);
|
|
end;
|
|
|
|
Function gdk_pixmap_create_from_xpm_d (window : PGdkWindow; var mask : PGdkBitmap; transparent_color : PGdkColor; data : PPgchar) : PGdkPixmap;
|
|
begin
|
|
result := gdk.gdk_pixmap_create_from_xpm_d(window, @mask, transparent_color, data)
|
|
end;
|
|
|
|
function gdk_pixmap_colormap_create_from_xpm_d (window : PGdkWindow; colormap: PGdkColormap; var mask : PGdkBitmap; transparent_color : PGdkColor; data : PPgchar) : PGdkPixmap;
|
|
begin
|
|
result := gdk.gdk_pixmap_colormap_create_from_xpm_d(window, colormap, @mask, transparent_color, data)
|
|
end;
|
|
|
|
function gdk_pixmap_colormap_create_from_xpm (window : PGdkWindow; colormap: PGdkColormap; var mask : PGdkBitmap; transparent_color : PGdkColor; filename : Pgchar) : PGdkPixmap;
|
|
begin
|
|
result := gdk.gdk_pixmap_colormap_create_from_xpm(window, colormap, @mask, transparent_color, filename)
|
|
end;
|
|
|
|
procedure gdk_pixbuf_render_pixmap_and_mask(pixbuf : PGdkPixbuf; var pixmap_return : PGdkPixmap; var mask_return : PGdkBitmap; alpha_threshold : gint);
|
|
begin
|
|
gdkpixbuf.gdk_pixbuf_render_pixmap_and_mask(pixbuf, @pixmap_return, @mask_return, alpha_threshold);
|
|
end;
|
|
|
|
function gdk_drawable_get_depth(Drawable : PGDKDrawable) : gint;
|
|
begin
|
|
gdk_window_get_geometry(Drawable, nil, nil, nil, nil, @result);
|
|
end;
|
|
|
|
procedure gdk_drawable_get_size(Drawable : PGDKDrawable; Width, Height : PGInt);
|
|
begin
|
|
gdk_window_get_geometry(Drawable, nil, nil, Width, Height, nil);
|
|
end;
|
|
|
|
function gdk_drawable_get_image(Drawable : PGDKDrawable; x, y, width, height : gint) : PGdkImage;
|
|
begin
|
|
result := gdk_image_get(Drawable, x, y, width, height);
|
|
end;
|
|
|
|
function gdk_drawable_get_colormap(Drawable : PGDKDrawable) : PGdkColormap;
|
|
begin
|
|
result := gdk_window_get_colormap(Drawable);
|
|
end;
|