NAME

Tk_CreatePhotoImageFormat - define new file format for photo images

SYNOPSIS


#include <tk.h> #include <tkPhoto.h>

Tk_CreatePhotoImageFormat(formatPtr)

ARGUMENTS

Tk_PhotoImageFormat *formatPtr (in)
Structure that defines the new file format.


DESCRIPTION

Tk_CreatePhotoImageFormat is invoked to define a new file format for image data for use with photo images. The code that implements an image file format is called an image file format handler, or handler for short. The photo image code maintains a list of handlers that can be used to read and write data to or from a file. Some handlers may also support reading image data from a string or converting image data to a string format. The user can specify which handler to use with the -format image configuration option or the -format option to the read and write photo image subcommands.

An image file format handler consists of a collection of procedures plus a Tk_PhotoImageFormat structure, which contains the name of the image file format and pointers to six procedures provided by the handler to deal with files and strings in this format. The Tk_PhotoImageFormat structure contains the following fields:
typedef struct Tk_PhotoImageFormat { char *name; Tk_ImageFileMatchProc *fileMatchProc; Tk_ImageStringMatchProc *stringMatchProc; Tk_ImageFileReadProc *fileReadProc; Tk_ImageStringReadProc *stringReadProc; Tk_ImageFileWriteProc *fileWriteProc; Tk_ImageStringWriteProc *stringWriteProc; } Tk_PhotoImageFormat;

The handler need not provide implementations of all six procedures. For example, the procedures that handle string data would not be provided for a format in which the image data are stored in binary, and could therefore contain null characters. If any procedure is not implemented, the corresponding pointer in the Tk_PhotoImageFormat structure should be set to NULL. The handler must provide the fileMatchProc procedure if it provides the fileReadProc procedure, and the stringMatchProc procedure if it provides the stringReadProc procedure.

name

formatPtr->name provides a name for the image type. Once Tk_CreatePhotoImageFormat returns, this name may be used in the -format photo image configuration and subcommand option. The manual page for the photo image (photo(n)) describes how image file formats are chosen based on their names and the value given to the -format option.

fileMatchProc

formatPtr->fileMatchProc provides the address of a procedure for Tk to call when it is searching for an image file format handler suitable for reading data in a given file. formatPtr->fileMatchProc must match the following prototype:
typedef int Tk_ImageFileMatchProc( FILE *f, char *fileName, char *formatString, int *widthPtr, int *heightPtr);
The fileName argument is the name of the file containing the image data, which is open for reading as f. The formatString argument contains the value given for the -format option, or NULL if the option was not specified. If the data in ing aecompute the bounding box in the item's header.

DCHARSPROC

typePtr->dCharsProc is invoked by Tk during the dchars widget command to delete a range of text from a canvas item. It is only relevant for item types that support text; typePtr->dCharsProc may be specified as NULL for non-textual item types. The procedure must match the following prototype:
typedef void Tk_ItemDCharsProc( Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last);
canvas and itemPtr have the usual meanings. first and last give the indices of the first and last bytes to be deleted, as returned by previous calls to typePtr->indexProc. The type manager should delete the specified characters and update the bounding box in the item's header.

SEE ALSO

Tk_CanvasPsY, Tk_CanvasTextInfo, Tk_CanvasTkwin

KEYWORDS

canvas, focus, item type, selection, type manager usr/doc/perl-tk/html/CrtMainWin.htm100644 0 0 22725 6443410171 15612 0ustar rootroot create or delete window

NAME

Tk_CreateMainWindow, Tk_CreateWindow, Tk_CreateWindowFromPath, Tk_DestroyWindow, Tk_MakeWindowExist - create or delete window

SYNOPSIS


#include <tk.h>

Tk_Window Tk_CreateMainWindow(interp, screenName, baseName, className)

Tk_Window Tk_CreateWindow(interp, parent, name, topLevScreen)

Tk_Window Tk_CreateWindowFromPath(interp, tkwin, pathName, topLevScreen)

Tk_DestroyWindow(tkwin)

Tk_MakeWindowExist(tkwin)

ARGUMENTS

Tcl_Interp *interp (out)
Tcl interpreter to use for error reporting. If no error occurs, then *interp isn't modified. For Tk_CreateMainWindow, this interpreter is associated permanently with the created window, and Tk-related commands are bound into the interpreter.
char *screenName (in)
String name of screen on which to create window. Has the form displayName.screenNum, where displayName is the name of a display and screenNum is a screen number. If the dot and screenNum are omitted, the screen number defaults to 0. If screenName is NULL or empty string, defaults to contents of DISPLAY environment variable.
char *baseName (in)
Name to use for this main window. See below for details.
char *className (in)
Class to use for application and for main window.
Tk_Window parent (in)
Token for the window that is to serve as the logical parent of the new window.
char *name (in)
Name to use for this window. Must be unique among all children of the same parent.
char *topLevScreen (in)
Has same format as screenName. If NULL, then new window is created as an internal window. If non-NULL, new window is created as a top-level window on screen topLevScreen. If topLevScreen is an empty string (``'') then new window is created as top-level window of parent's screen.
Tk_Window tkwin (in)
Token for window.
char *pathName (in)
Name of new window, specified as path name within application (e.g. .a.b.c).


DESCRIPTION

The three procedures Tk_CreateMainWindow, Tk_CreateWindow, and Tk_CreateWindowFromPath are used to create new windows for use in Tk-based applications. Each of the procedures returns a token that can be used to manipulate the window in other calls to the Tk library. If the window couldn't be created successfully, then NULL is returned and interp->result is modified to hold an error message.

Tk supports three different kinds of windows: main windows, internal windows, and top-level windows. A main window is the outermost window corresponding to an application. Main windows correspond to the independent units of an application, such as a view on a file that is part of an editor, or a clock, or a terminal emulator. A main window is created as a child of the root window of the screen indicated by the screenName. Each main window, and all its descendants, are typically associated with a single Tcl command interpreter. An internal window is an interior window of a Tk application, such as a scrollbar or menu bar or button. A top-level window is one that is created as a child of a screen's root window, rather than as an interior window, but which is logically part of some existing main window. Examples of top-level windows are pop-up menus and dialog boxes.

Tk_CreateMainWindow creates a new main window and associates its interp argument with that window and all its eventual descendants. Tk_CreateMainWindow also carries out several other actions to set up the new application. First, it adds all the Tk commands to those already defined for interp. Second, it turns the new window into a toplevel widget, which will cause the X window to be created and mapped as soon as the application goes idle.