Xaw3_1Mailbox.c revision 1233
749N/A * Copyright 1988 Massachusetts Institute of Technology 749N/A * Permission to use, copy, modify, and distribute this software and its 749N/A * documentation for any purpose and without fee is hereby granted, provided 749N/A * that the above copyright notice appear in all copies and that both that 749N/A * copyright notice and this permission notice appear in supporting 749N/A * documentation, and that the name of M.I.T. not be used in advertising or 749N/A * publicity pertaining to distribution of the software without specific, 749N/A * written prior permission. M.I.T. makes no representations about the 749N/A * suitability of this software for any purpose. It is provided "as is" 749N/A * without express or implied warranty. 749N/A * Author: Jim Fulton, MIT X Consortium 749N/A * I recommend that you use the new mailfull and mailempty bitmaps instead of 749N/A * XBiff*fullPixmap: mailfull 749N/A * XBiff*emptyPixmap: mailempty 749N/A * The default user interface is to have the mailbox turn itself off whenever 749N/A * the user presses a button in it. Expert users might want to make this 749N/A * happen on EnterWindow. It might be nice to provide support for some sort of 749N/A * exit callback so that you can do things like press q to quit. 749N/A "<ButtonPress>: unset()";
749N/A/* Initialization of defaults */ 749N/A /* class_name */ "Mailbox",
749N/A * widget initialization 749N/A * pretend there is new mail; put widget in flagup state 749N/A * ack the existing mail; put widget in flagdown state 749N/A * look to see if there is new mail; if so, Set, else Unset 749N/A * build up the pixmaps that we'll put into the image 749N/A /* case 1 is no change */ 749N/A /* treat everything else as no change */ 749N/A * Now check for changes. If reset is set then we want to pretent that 749N/A * there is no mail. If the mailbox is empty then we want to turn off 749N/A * the flag. Otherwise if the mailbox has changed size then we want to 749N/A * o forced reset by user DOWN 749N/A * o no mailbox or empty (zero-sized) mailbox DOWN 749N/A * o same size as last time no change 749N/A * o bigger than last time UP 749N/A * o smaller than last time but non-zero UP 749N/A * The last two cases can be expressed as different from last 749N/A * get user name for building mailbox 749N/A /* center the picture in the window */ 749N/A }
else {
/* paint the "down" position */ 749N/A * XXX - temporary hack; walk up widget tree to find top most parent (which 749N/A * will be a shell) and mash it to have our shape. This will be replaced 749N/A * by a special shell widget.