| 1 |
/* |
| 2 |
Copyright (c) 1995-2003 Nick Ing-Simmons. All rights reserved. |
| 3 |
This program is free software; you can redistribute it and/or |
| 4 |
modify it under the same terms as Perl itself. |
| 5 |
*/ |
| 6 |
#define PERL_NO_GET_CONTEXT |
| 7 |
#include <EXTERN.h> |
| 8 |
#include <perl.h> |
| 9 |
#include <XSUB.h> |
| 10 |
|
| 11 |
#include <tkGlue.def> |
| 12 |
|
| 13 |
#include <pTk/tkPort.h> |
| 14 |
#include <pTk/tkInt.h> |
| 15 |
#include <pTk/tkVMacro.h> |
| 16 |
#include <tkGlue.h> |
| 17 |
#include <tkGlue.m> |
| 18 |
|
| 19 |
DECLARE_VTABLES; |
| 20 |
|
| 21 |
static void Tk_ImageBackground _((Tk_Window win, char *imageString)); |
| 22 |
static void ButtonImageProc _((ClientData clientData, |
| 23 |
int x, int y, int width, int height, |
| 24 |
int imgWidth, int imgHeight)); |
| 25 |
|
| 26 |
static void |
| 27 |
BackgroundImageProc(clientData, x, y, width, height, imgWidth, imgHeight) |
| 28 |
ClientData clientData; /* Pointer to widget record. */ |
| 29 |
int x, y; /* Upper left pixel (within image) |
| 30 |
* that must be redisplayed. */ |
| 31 |
int width, height; /* Dimensions of area to redisplay |
| 32 |
* (may be <= 0). */ |
| 33 |
int imgWidth, imgHeight; /* New dimensions of image. */ |
| 34 |
{ |
| 35 |
} |
| 36 |
|
| 37 |
static void |
| 38 |
Tk_ImageBackground(tkwin, imageString) |
| 39 |
Tk_Window tkwin; |
| 40 |
char *imageString; |
| 41 |
{ |
| 42 |
Display *dpy = Tk_Display(tkwin); |
| 43 |
Tcl_Interp *interp = ((TkWindow*) tkwin)->mainPtr->interp; |
| 44 |
Tk_Image image = Tk_GetImage(interp, tkwin, |
| 45 |
imageString, BackgroundImageProc, (ClientData) tkwin); |
| 46 |
int width, height; |
| 47 |
Pixmap pixmap; |
| 48 |
Tk_SizeOfImage(image, &width, &height); |
| 49 |
Tk_MakeWindowExist(tkwin); |
| 50 |
pixmap = Tk_GetPixmap(dpy, Tk_WindowId(tkwin), width, height, Tk_Depth(tkwin)); |
| 51 |
Tk_RedrawImage(image, 0, 0, width, height, pixmap, 0, 0); |
| 52 |
Tk_SetWindowBackgroundPixmap(tkwin, pixmap); |
| 53 |
Tk_FreePixmap(dpy, pixmap); |
| 54 |
Tk_FreeImage(image); |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
MODULE = Tk::ImageBack PACKAGE = Tk PREFIX = Tk_ |
| 59 |
|
| 60 |
PROTOTYPES: DISABLE |
| 61 |
|
| 62 |
void |
| 63 |
Tk_ImageBackground(tkwin, imageString) |
| 64 |
Tk_Window tkwin |
| 65 |
char * imageString |
| 66 |
|
| 67 |
|
| 68 |
BOOT: |
| 69 |
{ |
| 70 |
IMPORT_VTABLES; |
| 71 |
} |
| 72 |
|