Xaw3_1Mailbox.c revision 749
501N/A * Copyright 1988 Massachusetts Institute of Technology 851N/A * Permission to use, copy, modify, and distribute this software and its 501N/A * documentation for any purpose and without fee is hereby granted, provided 501N/A * that the above copyright notice appear in all copies and that both that 501N/A * copyright notice and this permission notice appear in supporting 501N/A * documentation, and that the name of M.I.T. not be used in advertising or 501N/A * publicity pertaining to distribution of the software without specific, 501N/A * written prior permission. M.I.T. makes no representations about the 501N/A * suitability of this software for any purpose. It is provided "as is" 501N/A * without express or implied warranty. 501N/A * Author: Jim Fulton, MIT X Consortium 501N/A * I recommend that you use the new mailfull and mailempty bitmaps instead of 501N/A * XBiff*fullPixmap: mailfull 501N/A * XBiff*emptyPixmap: mailempty 501N/A * The default user interface is to have the mailbox turn itself off whenever 501N/A * the user presses a button in it. Expert users might want to make this 501N/A * happen on EnterWindow. It might be nice to provide support for some sort of 501N/A * exit callback so that you can do things like press q to quit. 501N/A "<ButtonPress>: unset()";
/* Initialization of defaults */ /* class_name */ "Mailbox",
/* class_part_initialize */ NULL,
/* class_inited */ FALSE,
/* initialize_hook */ NULL,
/* compress_motion */ TRUE,
/* compress_exposure */ TRUE,
/* compress_enterleave */ TRUE,
/* visible_interest */ FALSE,
/* set_values_hook */ NULL,
/* get_values_hook */ NULL,
/* callback_private */ NULL,
* pretend there is new mail; put widget in flagup state * ack the existing mail; put widget in flagdown state * look to see if there is new mail; if so, Set, else Unset * build up the pixmaps that we'll put into the image /* case 1 is no change */ /* treat everything else as no change */ * 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 * 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 if (
reset) {
/* forced reset */ }
else if (
mailboxsize == 0) {
/* no mailbox or empty */ * get user name for building mailbox /* center the picture in the window */ }
else {
/* paint the "down" position */ * 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.