/*
* $XConsortium: Mailbox.c,v 1.35 89/10/09 16:51:44 jim Exp $
*
* Copyright 1988 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* Author: Jim Fulton, MIT X Consortium
*
* I recommend that you use the new mailfull and mailempty bitmaps instead of
* the ugly mailboxes:
*
* XBiff*fullPixmap: mailfull
* XBiff*emptyPixmap: mailempty
*/
#include <stdio.h> /* for printing error messages */
#include <pwd.h> /* for getting username */
#include <stdlib.h> /* for system, exit */
#include <unistd.h> /* for getuid, getlogin */
#include <./Xaw3_1XawInit.h>
#include <./Xaw3_1MailboxP.h> /* for implementation mailbox stuff */
#ifdef SHAPE
#endif
/*
* The default user interface is to have the mailbox turn itself off whenever
* the user presses a button in it. Expert users might want to make this
* happen on EnterWindow. It might be nice to provide support for some sort of
* exit callback so that you can do things like press q to quit.
*/
static char defaultTranslations[] =
"<ButtonPress>: unset()";
{ "check", Check },
{ "unset", Unset },
{ "set", Set },
};
/* Initialization of defaults */
#ifdef SHAPE
#endif
};
static void GetMailFile(), CloseDown();
{ /* core fields */
/* superclass */ &widgetClassRec,
/* class_name */ "Mailbox",
/* widget_size */ sizeof(MailboxRec),
/* class_initialize */ ClassInitialize,
/* class_part_initialize */ NULL,
/* class_inited */ FALSE,
/* initialize */ Initialize,
/* initialize_hook */ NULL,
/* realize */ Realize,
/* actions */ actionsList,
/* resources */ resources,
/* xrm_class */ NULL,
/* compress_motion */ TRUE,
/* compress_exposure */ TRUE,
/* compress_enterleave */ TRUE,
/* visible_interest */ FALSE,
/* destroy */ Destroy,
/* resize */ NULL,
/* expose */ Redisplay,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
/* set_values_almost */ XtInheritSetValuesAlmost,
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
/* callback_private */ NULL,
/* tm_table */ defaultTranslations,
/* query_geometry */ XtInheritQueryGeometry,
/* display_accelerator */ XtInheritDisplayAccelerator,
/* extension */ NULL
}
};
/*
* widget initialization
*/
static void ClassInitialize ()
{
};
return;
}
{
}
/* ARGSUSED */
{
#ifdef SHAPE
#endif
if (w->mailbox.reverseVideo) {
}
#ifdef SHAPE
#endif
return;
}
/*
* action procedures
*/
/*
* pretend there is new mail; put widget in flagup state
*/
/* ARGSUSED */
{
return;
}
/*
* ack the existing mail; put widget in flagdown state
*/
/* ARGSUSED */
{
return;
}
/*
* look to see if there is new mail; if so, Set, else Unset
*/
/* ARGSUSED */
{
return;
}
/* ARGSUSED */
static void clock_tic (
{
/*
* and reset the timer
*/
(caddr_t) w);
return;
}
int depth;
{
int x, y;
return None;
if (flip) {
} else {
}
}
{
*valuemaskp, attr);
/*
* build up the pixmaps that we'll put into the image
*/
(const char *)mailfull_bits,
}
(const char *)mailempty_bits,
}
#ifdef SHAPE
#endif
(caddr_t) w);
#ifdef SHAPE
#endif
return;
}
{
#ifdef SHAPE
#endif
return;
}
{
}
{
long mailboxsize = 0;
case 0:
break;
/* case 1 is no change */
case 2:
mailboxsize = 0;
/* treat everything else as no change */
}
}
else {
}
}
/*
* Now check for changes. If reset is set then we want to pretent that
* there is no mail. If the mailbox is empty then we want to turn off
* the flag. Otherwise if the mailbox has changed size then we want to
* put the flag up.
*
* The cases are:
* o forced reset by user DOWN
* o no mailbox or empty (zero-sized) mailbox DOWN
* o same size as last time no change
* o bigger than last time UP
* o smaller than last time but non-zero UP
*
* The last two cases can be expressed as different from last
* time and non-zero.
*/
if (reset) { /* forced reset */
force_redraw = TRUE;
} else if (mailboxsize == 0) { /* no mailbox or empty */
beep(w);
force_redraw = TRUE;
}
if (force_redraw) redraw_mailbox (w);
return;
}
/*
* get user name for building mailbox
*/
static void GetMailFile (w)
{
char *username;
if (!username) {
if (!pw) {
"Mailbox widget");
CloseDown (w, 1);
}
}
return;
}
int status;
{
XtDestroyWidget ((Widget)w);
XCloseDisplay (dpy);
}
/* ARGSUSED */
{
}
}
return (redisplay);
}
/*
* drawing code
*/
static void redraw_mailbox (w)
{
register int x, y;
/* center the picture in the window */
} else { /* paint the "down" position */
}
#ifdef SHAPE
/*
* XXX - temporary hack; walk up widget tree to find top most parent (which
* will be a shell) and mash it to have our shape. This will be replaced
* by a special shell widget.
*/
}
w->mailbox.shape_cache.x = x;
w->mailbox.shape_cache.y = y;
}
}
#endif
return;
}
static void beep (w)
{
return;
}