Functions | |
void | mt_give_iconifyxywh (APPvar *app, INT16 *x, INT16 *y, INT16 *w, INT16 *h) |
give a valid position where iconify a window | |
void | mt_snd_rdw (APPvar *app, WINDOW *win) |
send a WM_REDRAW message for the work area of this window | |
void | mt_snd_arrw (APPvar *app, WINDOW *win, int msg) |
send a WM_ARROWED message | |
void | mt_snd_msg (APPvar *app, WINDOW *win, int msg, int par1, int par2, int par3, int par4) |
send a message to itself. | |
void | rc_set (GRECT *, int, int, int, int) |
Initialize a GRECT data. | |
void | rc_lset (LGRECT *, long, long, long, long) |
Initialize a LGRECT data. | |
void | w_getpal (APPvar *app, WINDOW *win) |
save in a buffer the current screen color palette | |
void | w_setpal (APPvar *app, WINDOW *win) |
restore a screen color palette | |
int | w_get_hndl (APPvar *app, WINDOW *win) |
Returns the WINDOW's real AES handle. | |
void | w_get_bkgr (APPvar *app, int of_x, int of_y, int of_w, int of_h, MFDB *img) |
save a screen area | |
void | w_put_bkgr (APPvar *app, int of_x, int of_y, int of_w, int of_h, MFDB *img) |
Restore a saved screen area. | |
int | keybd2ascii (int keybd, int shift) |
get the ascii code of a keyboard event | |
char * | conv_path (char *) |
convert a file name between TOS and MiNT formats | |
int | mt_ShelHelp (APPvar *app, char *file, char *chapter) |
Interface to the AES helper service. | |
int | mt_ShelWrite (APPvar *app, char *prg, char *cmd, void *env, int av, int single) |
Launch GEM or TOS applications. | |
void | mt_DebugWindom (APPvar *app, const char *format,...) |
print formated string to debug output | |
void * | Galloc (long size) |
Allocate memory in global mode. | |
void | mt_GrectCenter (APPvar *app, int w, int h, INT16 *x, INT16 *y) |
Centering an area on screen. | |
void | mt_ClipOn (APPvar *app, W_GRAFPORT *graf, GRECT *r) |
set clipping area for drawing | |
void | mt_ClipOff (APPvar *app, W_GRAFPORT *graf) |
unset clipping area for drawing | |
void | rc_lgrect2grect (GRECT *, const LGRECT *) |
Convert the LGRECT values to GRECT. | |
void | rc_grect2lgrect (LGRECT *, const GRECT *) |
Convert the GRECT values to LGRECT. | |
short | rc_lintersect (const LGRECT *r1, LGRECT *r2) |
Compute the interesection of two LGRECT rectangles. |
char* conv_path | ( | char * | p | ) |
convert a file name between TOS and MiNT formats
p | buffer containing the path to convert |
Some examples:
folder\dum.cnf
is converted in folder/dum
.cnf/c/multitos/mint
.cnf" is converted in c:\multitos\mint.cnf
/etc/passwd"
is converted to U:\etc\passwd
/u/etc/passwd"
is converted in u:\etc\passwd
/etc/passwd"
is converted in U:\etc\passwd
void* Galloc | ( | long | size | ) |
Allocate memory in global mode.
size | memory size required (in byte), |
For managing GEM message event pointing on shared data, WinDom reserves a buffer for this purpose (WinDom kernel can use it for special message) : the variable app->pipe (or gl_appvar.pipe) points to a 256-byte buffer allocated with Galloc().
// Safe example #include <av.h> // For VA_START constant void send_file_to_qed( char *file) { char *path = Galloc( strlen(file) + 1); strcpy( path, file); ApplWrite( appl_find( "QED "), VA_START, ADR(path), 0, 0, 0); Mfree( path); } // Same example, shorter but less safe #define SEND_FILE_TO_QED(file) AppWrite( appl_find( "QED "), VA_START, ADR(strcpy(app.pipe,file), 0, 0, 0)
int keybd2ascii | ( | int | keybd, | |
int | shift | |||
) |
get the ascii code of a keyboard event
keybd | keyboard scancode provides by evnt_keybd() or MU_KEYBD event, | |
shift | should be set to 1 if the shift key is depressed, 0 else |
#include <windom.h> #include <scancode.h> // definition of keyboard scancodes void ex_keybd( WINDOW *win) { char key = keybd2ascii( evnt.keybd, evnt.mkstate & (K_LSHIFT|K_RSHIFT)); switch( key) { case 'w': case 'W': // key w if( evnt.mkstate & K_CTRL) ; // key Control-w break; // ... default: // Some keys have no ascii code (function key, numeric pad, ...). // These keys can be identified by their scancode. switch( evnt.keybd>>8) { case SC_HELP: // HELP key break; // ... } } }
void mt_ClipOff | ( | APPvar * | app, | |
W_GRAFPORT * | graf | |||
) |
unset clipping area for drawing
app | application descriptor | |
graf | grafport which contain the VDI handle |
As for mt_ClipOn(), for most applications this function should not be use
void mt_ClipOn | ( | APPvar * | app, | |
W_GRAFPORT * | graf, | |||
GRECT * | r | |||
) |
set clipping area for drawing
app | application descriptor | |
graf | grafport which contain the VDI handle | |
r | the area to clip |
This function is useless for most applications. Most of the time, application draw stuff to the screen only after a WM_REDRAW message, and in that case windom has already set the clipping area before inoking the callback function attached to the WM_REDRAW message.
void mt_DebugWindom | ( | APPvar * | app, | |
const char * | format, | |||
... | ||||
) |
print formated string to debug output
app | application descriptor | |
format | formatted string (similar to printf) | |
... | paramters of format (similar to printf) |
void mt_give_iconifyxywh | ( | APPvar * | app, | |
INT16 * | x, | |||
INT16 * | y, | |||
INT16 * | w, | |||
INT16 * | h | |||
) |
give a valid position where iconify a window
app | application descriptor | |
x,y,w,h | position and size of the icon window |
{
short x,y,w,h;
give_iconify( win, &x, &y, &w, &h);
WindSet( win, WF_ICONFY, x, y, w, h);
}
Depending the OS, the way to compute the iconify position is different:
With PlainTOS, it is not necessary to have an iconify mechanism because mt_EvntWindom() offers to the user to iconify a window when the smaller widget is not present (by shift-clicking the closer widget).
void mt_GrectCenter | ( | APPvar * | app, | |
int | w, | |||
int | h, | |||
INT16 * | x, | |||
INT16 * | y | |||
) |
Centering an area on screen.
app | application descriptor, | |
w,h | size of area to center, | |
x,y | at return, contain coordinate of the centered area. |
User can change the way mt_GrectCenter() centers the areas by editing the variable windom.window.center in the WinDom configuration file. Windows and formulars can be centered at screen or in a corner, centered on the mouse sprite, one can leave the OS decide ...
int mt_ShelHelp | ( | APPvar * | app, | |
char * | file, | |||
char * | chapter | |||
) |
Interface to the AES helper service.
app | application descriptor | |
file | help file to display (or any regular file) | |
chapter | string to find in file |
// Display in ST-Guide a simple text file ShelWrite( "C:\\NEWDESK.INF", ""); // Find the WINDOM.HYP file in ST-Guide paths and display it ShellWrite( "*:\\WINDOM.HYP", ""); // Find in the WINDOM.HYP file the ShelWrite() reference and display it ShelWrite( "*:\\WINDOM.HYP", "ShelWrite()"); // Find in the ST-Guide indexes a simple reference ShelWrite( "", "A simple reference");
int mt_ShelWrite | ( | APPvar * | app, | |
char * | prg, | |||
char * | cmd, | |||
void * | env, | |||
int | av, | |||
int | single | |||
) |
Launch GEM or TOS applications.
app | application descriptor, | |
prg | full or relative path of program to execute, | |
cmd | command line or NULL, | |
env | environ string or NULL, | |
av | if TRUE, try to send a VA_START if possible, | |
single | if TRUE, execute in single mode, |
In a multitask environnment, applications are launched in parallel. With the parameter single set to TRUE, applications are lauched in single mode. If the parameter av is set to TRUE, a VA_START message is sent to the GEM application if it is running. Otherwise, a FALSE value has the consequent to create multiple application. Note : if an VA_START is sent, one waits for AV_STARTED message, as stated by the AV-protocol and the function returns -2 if this message is not received.
The parameter cmd describe the command line given to the application. The format is different of Pexec() or mt_shel_write() (ie the first character does not contain the lenght of the string).
Desktop accessories can not be launched.
send a WM_ARROWED message
app | application descriptor | |
win | window which will be the target of the WM_ARROWED message | |
type | one of the WA_xxx constants defined by gemlib |
send a message to itself.
app | application descriptor | |
win | target of the message (used for element buff[1] of the message) | |
msg | id buff[0] of the message | |
par1,par2,par3,par4 | are buff[4..7] of the message. |
send a WM_REDRAW message for the work area of this window
app | application descriptor | |
win | window to redraw |
void rc_grect2lgrect | ( | LGRECT * | l, | |
const GRECT * | r | |||
) |
Convert the GRECT values to LGRECT.
l | output rectangle | |
r | input rectangle |
void rc_lgrect2grect | ( | GRECT * | r, | |
const LGRECT * | l | |||
) |
Convert the LGRECT values to GRECT.
r | output rectangle | |
l | input rectangle |
Compute the interesection of two LGRECT rectangles.
r1 | the first rectangle | |
r2 | the other rectangle. The intersection area will be returned in r2 . |
r2
will contain the common area. void rc_lset | ( | LGRECT * | rect, | |
long | x, | |||
long | y, | |||
long | w, | |||
long | h | |||
) |
Initialize a LGRECT data.
rect | the LGRECT structure to initialize | |
x,y,w,h | values to put in rect |
void rc_set | ( | GRECT * | rect, | |
int | x, | |||
int | y, | |||
int | w, | |||
int | h | |||
) |
Initialize a GRECT data.
rect | the GRECT structure to initialize | |
x,y,w,h | values to put in rect |
void w_get_bkgr | ( | APPvar * | app, | |
int | of_x, | |||
int | of_y, | |||
int | of_w, | |||
int | of_h, | |||
MFDB * | img | |||
) |
save a screen area
app | application descriptor | |
of_x,of_y,of_w,of_h | coordinate and size of the area to save | |
img | a valid MFDB structure will containing the screen area saved |
Returns the WINDOW's real AES handle.
To be used when sending a message to a WINDOW instance containing AES window handle (like e.g. snd_rdw()).
app | application descriptor, | |
win | target window (or NULL for application scope), |
save in a buffer the current screen color palette
app | application descriptor | |
win | window descriptor or NULL |
void w_put_bkgr | ( | APPvar * | app, | |
int | of_x, | |||
int | of_y, | |||
int | of_w, | |||
int | of_h, | |||
MFDB * | img | |||
) |
Restore a saved screen area.
app | application descriptor | |
of_x,of_y,of_w,of_h | coordinate and size of the area to restore | |
img | a valid MFDB structure containing the screen area saved. |
restore a screen color palette
app | application descriptor | |
win | window descriptor or NULL |