home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / src / Logo.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  17.6 KB  |  707 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /*---------------------------------------*/
  19. /*                                                                        */
  20. /* Name:        Logo.cpp                                                */
  21. /* Description:    XFE_Logo component source.                                */
  22. /* Author:        Ramiro Estrugo <ramiro@netscape.com>                    */
  23. /*                                                                        */
  24. /*----------------------------------------------------------------------*/
  25.  
  26.  
  27.  
  28. #include "Logo.h"
  29. #include "xpassert.h"
  30. #include "MozillaApp.h"
  31. #include "icondata.h"
  32. #include "e_kit.h"
  33.  
  34. #include <Xfe/XfeAll.h>
  35.  
  36.  
  37. /* static */ Pixmap **        
  38. XFE_Logo::_small_animation_pixmaps = NULL;
  39.  
  40. /* static */ fe_icon_data **
  41. XFE_Logo::_small_animation_data = NULL;
  42.  
  43. /* static */ Pixmap **        
  44. XFE_Logo::_large_animation_pixmaps = NULL;
  45.  
  46. /* static */ fe_icon_data **
  47. XFE_Logo::_large_animation_data = NULL;
  48.  
  49. /* static */ Cardinal             
  50. XFE_Logo::_num_animations = 0;
  51.  
  52. /* static */ Cardinal *        
  53. XFE_Logo::_animation_frame_counts = NULL;
  54.  
  55. #define DEFAULT_ANIMATION        XFE_ANIMATION_MAIN
  56. #define DEFAULT_SIZE            XFE_ANIMATION_LARGE
  57.  
  58. // baggage
  59. extern "C" 
  60. {
  61.     void fe_NetscapeCallback(Widget, XtPointer, XtPointer);
  62. };
  63.  
  64. //////////////////////////////////////////////////////////////////////////
  65. XFE_Logo::XFE_Logo(XFE_Frame *        frame,
  66.                    Widget            parent,
  67.                    const char *        name,
  68.                    int                /* interval */) :
  69.     XFE_Component(frame),
  70.     _frame(frame),
  71. #ifdef NETSCAPE_PRIV
  72.     _mozillaEasterEgg(False),
  73. #endif /* NETSCAPE_PRIV */
  74.     _type(DEFAULT_ANIMATION),
  75.     _size(DEFAULT_SIZE)
  76. {
  77.     XP_ASSERT( XfeIsAlive(parent) );
  78.     XP_ASSERT( name != NULL );
  79.  
  80.     // Create the base widget - a tool item
  81.     m_widget = XtVaCreateWidget(name,
  82.                                 xfeLogoWidgetClass,
  83.                                 parent,
  84.  
  85.                                 XmNtraversalOn,            True,
  86.                                 XmNhighlightThickness,    0,
  87.  
  88.                                 NULL);
  89.  
  90.     // Add tooltip to logo
  91.     fe_WidgetAddToolTips(m_widget);
  92.  
  93.     // Add the netscape callback
  94.     XtAddCallback(m_widget,
  95.                   XmNactivateCallback,
  96.                   fe_NetscapeCallback, 
  97.                   (XtPointer) _frame->getContext());
  98.  
  99.     XtAddCallback(m_widget,
  100.                   XmNdisarmCallback,
  101.                   &XFE_Logo::logoCallback,
  102.                   (XtPointer) this);
  103.                   
  104.     XtAddCallback(m_widget,
  105.                   XmNactivateCallback,
  106.                   &XFE_Logo::logoCallback,
  107.                   (XtPointer) this);
  108.  
  109.     if ( ekit_CustomAnimation() ) {
  110.         _type = XFE_ANIMATION_CUSTOM;
  111.     }
  112.  
  113.     // Initizlize the animations if they are not valid
  114.     if (!XFE_Logo::animationsAreValid())
  115.     {
  116.         XFE_Logo::initAnimationData();
  117.     }
  118.  
  119.     updatePixmaps();
  120.  
  121.     installDestroyHandler();
  122. }
  123. //////////////////////////////////////////////////////////////////////////
  124. XFE_Logo::~XFE_Logo()
  125. {
  126. }
  127. //////////////////////////////////////////////////////////////////////////
  128.  
  129.  
  130.  
  131. //////////////////////////////////////////////////////////////////////////
  132. //
  133. // Accessors
  134. //
  135. //////////////////////////////////////////////////////////////////////////
  136. Cardinal
  137. XFE_Logo::getCurrentFrame()
  138. {
  139.     XP_ASSERT( XfeIsAlive(m_widget) );
  140.  
  141.     Cardinal index;
  142.     
  143.     XtVaGetValues(m_widget,XmNcurrentPixmapIndex,&index,NULL);
  144.  
  145.     return index;
  146. }
  147. //////////////////////////////////////////////////////////////////////////
  148. EAnimationSize
  149. XFE_Logo::getSize()
  150. {
  151.     return _size;
  152. }
  153. //////////////////////////////////////////////////////////////////////////
  154. EAnimationType
  155. XFE_Logo::getType()
  156. {
  157.     return _type;
  158. }
  159. //////////////////////////////////////////////////////////////////////////
  160. XP_Bool
  161. XFE_Logo::isRunning()
  162. {
  163.     XP_ASSERT( XfeIsAlive(m_widget) );
  164.  
  165.     Boolean is_running;
  166.  
  167.     XtVaGetValues(m_widget,XmNanimationRunning,&is_running,NULL);
  168.  
  169.     return is_running;
  170. }
  171. //////////////////////////////////////////////////////////////////////////
  172.  
  173. //////////////////////////////////////////////////////////////////////////
  174. //
  175. // Mutators
  176. //
  177. //////////////////////////////////////////////////////////////////////////
  178. void
  179. XFE_Logo::setCurrentFrame(Cardinal index)
  180. {
  181.     XP_ASSERT( XfeIsAlive(m_widget) );
  182.  
  183.     XtVaSetValues(m_widget,XmNcurrentPixmapIndex,index,NULL);
  184. }
  185. //////////////////////////////////////////////////////////////////////////
  186. void
  187. XFE_Logo::setInterval(Cardinal interval)
  188. {
  189.     XP_ASSERT( XfeIsAlive(m_widget) );
  190.     XP_ASSERT( interval > 0 );
  191.  
  192.     XtVaSetValues(m_widget,XmNanimationInterval,interval,NULL);
  193. }
  194. //////////////////////////////////////////////////////////////////////////
  195. void
  196. XFE_Logo::setSize(EAnimationSize size)
  197. {
  198.     XP_ASSERT( XfeIsAlive(m_widget) );
  199.  
  200.     XP_ASSERT( size >= XFE_ANIMATION_LARGE );
  201.     XP_ASSERT( size <= XFE_ANIMATION_SMALL );
  202.  
  203.     if (_size == size)
  204.     {
  205.         return;
  206.     }
  207.  
  208.     _size = size;
  209.  
  210.     updatePixmaps();
  211. }
  212. //////////////////////////////////////////////////////////////////////////
  213. void
  214. XFE_Logo::setType(EAnimationType type)
  215. {
  216.     XP_ASSERT( XfeIsAlive(m_widget) );
  217.  
  218.     XP_ASSERT( type >= 0 );
  219.     XP_ASSERT( type < XFE_ANIMATION_MAX );
  220.  
  221. #ifdef NETSCAPE_PRIV
  222.     // Mozilla rules
  223.     if (_mozillaEasterEgg)
  224.     {
  225.         _type = XFE_ANIMATION_MOZILLA;
  226.  
  227.         updatePixmaps();
  228.  
  229.         return;
  230.     }
  231. #endif /* NETSCAPE_PRIV */
  232.  
  233.     if (_type == type || _type == XFE_ANIMATION_CUSTOM)
  234.     {
  235.         return;
  236.     }
  237.  
  238.     _type = type;
  239.  
  240.     updatePixmaps();
  241. }
  242. //////////////////////////////////////////////////////////////////////////
  243.  
  244. //////////////////////////////////////////////////////////////////////////
  245. //
  246. // Control methods
  247. //
  248. //////////////////////////////////////////////////////////////////////////
  249. void
  250. XFE_Logo::reset()
  251. {
  252.      XP_ASSERT( XfeIsAlive(m_widget) );
  253.  
  254.      XfeLogoAnimationReset(m_widget);
  255. }
  256. //////////////////////////////////////////////////////////////////////////
  257. void
  258. XFE_Logo::start()
  259. {
  260.     XP_ASSERT( XfeIsAlive(m_widget) );
  261.  
  262.     XfeLogoAnimationStart(m_widget);
  263. }
  264. //////////////////////////////////////////////////////////////////////////
  265. void
  266. XFE_Logo::stop()
  267. {
  268.     XP_ASSERT( XfeIsAlive(m_widget) );
  269.  
  270.     XfeLogoAnimationStop(m_widget);
  271.  
  272. #ifdef NETSCAPE_PRIV
  273.     // For compass or mozilla, we want the animation to continue where it
  274.     // stopped.  Tell the logo widget not too reset the pixmap when its idle.
  275.     if ((_type == XFE_ANIMATION_COMPASS) ||
  276.         (_type == XFE_ANIMATION_MOZILLA))
  277.     {
  278.         XtVaSetValues(m_widget,XmNresetWhenIdle,False,NULL);
  279.     }
  280.     else
  281. #endif /* NETSCAPE_PRIV */
  282.     {
  283.         XtVaSetValues(m_widget,XmNresetWhenIdle,True,NULL);
  284.         setCurrentFrame(0);
  285.     }
  286. }
  287. //////////////////////////////////////////////////////////////////////////
  288.  
  289. #ifdef NETSCAPE_PRIV
  290.  
  291. // Only Jamie gets the compass, everyone else gets MOZILLA.
  292. #define JWZ 9
  293.  
  294. static String _ee_xheads[] =
  295. {
  296.     "\244\256\256\244\261\244",                // akkana
  297.     "\245\265\254\244\261\262",                // briano
  298.     "\245\266\267\250\257\257",                // bstell
  299.     "\246\262\261\271\250\265\266\250",        // converse
  300.     "\247\255\272",                            // djw
  301.     "\247\262\265\244",                        // dora
  302.     "\247\263",                                // dp
  303.     "\251\265\244\261\246\254\266",            // francis
  304.     "\256\254\261",                            // kin
  305.     "\255\272\275",                            // jwz
  306.     "\257\272\250\254",                        // lwei
  307.     "\260\246\244\251\250\250",                // mcafee
  308.     "\265\244\247\253\244",                    // radha
  309.     "\265\244\260\254\265\262",                // ramiro
  310.     "\265\253\250\266\266",                    // rhess
  311.     "\265\262\247\267",                        // rodt
  312.     "\266\257\244\260\260",                    // slamm
  313.     "\266\263\250\261\246\250",                // spence
  314.     "\267\244\262",                            // tao
  315.     "\267\262\266\253\262\256",                // toshok
  316.     "\275\255\244\261\245\244\274"            // zjanbay
  317. };
  318.  
  319. static String _ee_home_urls[] =
  320. {
  321.     /*
  322.      * http://home.netscape.com/people/ 
  323.      */
  324.     "\253\267\267\263\175\162\162\253\262\260\250"
  325.     "\161\261\250\267\266\246\244\263\250"
  326.     "\161\246\262\260\162\263\250\262\263\257\250\162",
  327.  
  328.     /*
  329.      * http://www.netscape.com/people/ 
  330.      */
  331.     "\253\267\267\263\175\162\162\272\272\272"
  332.     "\161\261\250\267\266\246\244\263\250"
  333.     "\161\246\262\260\162\263\250\262\263\257\250\162",
  334.  
  335.     /* 
  336.      * http://people.netscape.com/ 
  337.      */
  338.     "\253\267\267\263\175\162\162\263\250\262"
  339.     "\263\257\250\161\261\250\267\266\246\244"
  340.     "\263\250\161\246\262\260\162",
  341. };
  342.  
  343. #define _EE_NUM_XHEADS ((int) XtNumber(_ee_xheads))
  344.  
  345. static String _ee_xheads_bufs[_EE_NUM_XHEADS];
  346.  
  347. static Cardinal _ee_xheads_lengths[_EE_NUM_XHEADS];
  348.  
  349. #define _EE_NUM_HOME_URLS ((int) XtNumber(_ee_home_urls))
  350.  
  351. static String _ee_home_urls_bufs[_EE_NUM_HOME_URLS];
  352.  
  353. static Cardinal _ee_home_urls_lengths[_EE_NUM_HOME_URLS];
  354.  
  355. #define _EE_MAGIC_NUMBER 67
  356.  
  357. static Boolean _ee_first_time = True;
  358.  
  359. static String _ee_about_mozilla =
  360. "\244\245\262\270\267\175\260\262\275\254\257\257\244";
  361.  
  362. static String _ee_about_mozilla_buf;
  363.  
  364. //////////////////////////////////////////////////////////////////////////
  365. static void _ee_un_obfuscate(char * s)
  366. {
  367.     if (!s) 
  368.         return;
  369.  
  370.     char * p = s; 
  371.  
  372.     while(*p) 
  373.     { 
  374.         *p -= _EE_MAGIC_NUMBER; p++; 
  375.     }
  376. }
  377. //////////////////////////////////////////////////////////////////////////
  378. void
  379. XFE_Logo::easterEgg(URL_Struct * url)
  380. {
  381.     // Sanity check
  382.     if (!url || !url->address || !*url->address)
  383.     {
  384.         return;
  385.     }
  386.  
  387.     int i;
  388.  
  389.     // The "first time" we allocate non static memory for all the easter 
  390.     // egg strings and un-obfuscate them
  391.     if (_ee_first_time)
  392.     {
  393.         _ee_first_time = False;
  394.  
  395.         _ee_about_mozilla_buf = (String) XtNewString(_ee_about_mozilla);
  396.         _ee_un_obfuscate(_ee_about_mozilla_buf);
  397.  
  398.         for(i = 0; i < _EE_NUM_XHEADS; i++)
  399.         {
  400.             _ee_xheads_bufs[i] = (String) XtNewString(_ee_xheads[i]);
  401.  
  402.             _ee_un_obfuscate(_ee_xheads_bufs[i]);
  403.  
  404.             _ee_xheads_lengths[i] = XP_STRLEN(_ee_xheads_bufs[i]);
  405.         }
  406.  
  407.         for(i = 0; i < _EE_NUM_HOME_URLS; i++)
  408.         {
  409.             _ee_home_urls_bufs[i] = (String) XtNewString(_ee_home_urls[i]);
  410.  
  411.             _ee_un_obfuscate(_ee_home_urls_bufs[i]);
  412.  
  413.             _ee_home_urls_lengths[i] = XP_STRLEN(_ee_home_urls_bufs[i]);
  414.         }
  415.     }
  416.  
  417.     // Look for about:mozilla
  418.     if (XP_STRCMP(url->address,_ee_about_mozilla_buf) == 0)
  419.     {
  420.         _mozillaEasterEgg = True;
  421.  
  422.         setType(XFE_ANIMATION_MOZILLA);
  423.  
  424.         return;
  425.     }
  426.  
  427.     XP_Bool found_xheads_prefix = False;
  428.     int        xheads_prefix_offset = 0;
  429.  
  430.     i = 0;
  431.  
  432.     // Look for one of the xheads home url prefixes
  433.     while ((i < _EE_NUM_HOME_URLS) && !found_xheads_prefix)
  434.     {
  435.         if (XP_STRNCMP(url->address,
  436.                        _ee_home_urls_bufs[i],
  437.                        _ee_home_urls_lengths[i]) == 0)
  438.         {
  439.             found_xheads_prefix = True;
  440.             xheads_prefix_offset = _ee_home_urls_lengths[i];
  441.         }
  442.  
  443.         i++;
  444.     }
  445.  
  446.     // Look for one of the xheads
  447.     if (found_xheads_prefix)
  448.     {
  449.         char * possible_xhead = url->address + xheads_prefix_offset;
  450.  
  451.         if (possible_xhead && *possible_xhead)
  452.         {
  453.             // Look for jwz
  454.             if (XP_STRNCMP(possible_xhead,
  455.                            _ee_xheads_bufs[JWZ],
  456.                            _ee_xheads_lengths[JWZ]) == 0) {
  457.                 setType(XFE_ANIMATION_COMPASS);
  458.                 
  459.                 XtVaSetValues(m_widget,XmNresetWhenIdle,False,NULL);
  460.                 
  461.                 return;
  462.             }
  463.             
  464.             // Look for xheads
  465.             for(i = 0; i < _EE_NUM_XHEADS; i++)
  466.             {
  467.                 if (XP_STRNCMP(possible_xhead,
  468.                                _ee_xheads_bufs[i],
  469.                                _ee_xheads_lengths[i]) == 0)
  470.                 {
  471.                     setType(XFE_ANIMATION_MOZILLA);
  472.  
  473.                     XtVaSetValues(m_widget,XmNresetWhenIdle,False,NULL);
  474.  
  475.                     return;
  476.                 }
  477.             }
  478.         }
  479.     }
  480.  
  481.     // Default to the 4.x animation
  482.     setType(XFE_ANIMATION_XNETSCAPE4);
  483.  
  484.     XtVaSetValues(m_widget,XmNresetWhenIdle,True,NULL);
  485. }
  486.  
  487. #endif /* NETSCAPE_PRIV */
  488. //////////////////////////////////////////////////////////////////////////
  489.  
  490. /* static */ Pixmap *
  491. XFE_Logo::createAnimation(XFE_Frame *        frame,
  492.                           Widget            logo,
  493.                           fe_icon_data *    animation_data,
  494.                           Cardinal            num_frames)
  495. {
  496.     XP_ASSERT( frame != NULL );
  497.     XP_ASSERT( animation_data != NULL );
  498.     XP_ASSERT( num_frames > 0 );
  499.  
  500.     Cardinal    i;
  501.     Pixmap *    pixmaps = NULL;
  502.  
  503.     pixmaps = new Pixmap[num_frames];
  504.  
  505.     for(i = 0; i < num_frames; i++)
  506.     {
  507.         pixmaps[i] = XFE_Logo::createPixmap(frame,logo,&animation_data[i]);
  508.     }
  509.  
  510.     return pixmaps;
  511. }
  512. //////////////////////////////////////////////////////////////////////////
  513. /* static */ Pixmap
  514. XFE_Logo::createPixmap(XFE_Frame *        frame,
  515.                        Widget            logo,
  516.                        fe_icon_data *    icon_data)
  517. {
  518.     XP_ASSERT( frame != NULL );
  519.     XP_ASSERT( XfeIsAlive(logo) );
  520.     XP_ASSERT( icon_data != NULL );
  521.  
  522.     fe_icon icon;
  523.  
  524.     icon.pixmap = 0;
  525.  
  526.     fe_NewMakeIcon(frame->getBaseWidget(),
  527.                    XfeForeground(logo),
  528.                    XfeBackground(logo),
  529.                    &icon,
  530.                    NULL,
  531.                    icon_data->width,
  532.                    icon_data->height,
  533.                    icon_data->mono_bits,
  534.                    icon_data->color_bits,
  535.                    icon_data->mask_bits,
  536.                    False);
  537.  
  538.     assert( XfePixmapGood(icon.pixmap) );
  539.  
  540.     return icon.pixmap;
  541. }
  542. //////////////////////////////////////////////////////////////////////////
  543. /* static */ XP_Bool
  544. XFE_Logo::animationsAreValid()
  545. {
  546.     return (_small_animation_pixmaps &&
  547.             _large_animation_pixmaps &&
  548.             _large_animation_data &&
  549.             _small_animation_data &&
  550.             _small_animation_data);
  551. }
  552. //////////////////////////////////////////////////////////////////////////
  553. /* static */ void
  554. XFE_Logo::initAnimationData()
  555. {
  556.     assert( !XFE_Logo::animationsAreValid() );
  557.  
  558.     // Allocate space for the pixmaps and data
  559.     _num_animations = 4;
  560.     
  561.     _small_animation_pixmaps = new Pixmap * [_num_animations];
  562.     _small_animation_data = new fe_icon_data * [_num_animations];
  563.  
  564.     _large_animation_pixmaps = new Pixmap * [_num_animations];
  565.     _large_animation_data = new fe_icon_data * [_num_animations];
  566.  
  567.     _animation_frame_counts = new Cardinal [_num_animations];
  568.  
  569.  
  570.     // Initialize all the pixmaps and data
  571.     Cardinal i;
  572.  
  573.     for (i = 0; i < _num_animations; i++)
  574.     {
  575.         _small_animation_pixmaps[i] = NULL;
  576.         _small_animation_data[i] = NULL;
  577.  
  578.         _large_animation_pixmaps[i] = NULL;
  579.         _large_animation_data[i] = NULL;
  580.  
  581.         _animation_frame_counts[i] = 0;
  582.     }
  583.  
  584.     // Initialize the animation counts
  585.     _small_animation_data    [XFE_ANIMATION_MAIN] = anim_main_small;
  586.     _large_animation_data    [XFE_ANIMATION_MAIN] = anim_main_large;
  587.     _animation_frame_counts    [XFE_ANIMATION_MAIN] = fe_anim_frames[XFE_ANIMATION_MAIN*2];
  588.  
  589. #ifdef NETSCAPE_PRIV
  590.     _small_animation_data    [XFE_ANIMATION_COMPASS]  = anim_compass_small;
  591.     _large_animation_data    [XFE_ANIMATION_COMPASS]  = anim_compass_large;
  592.     _animation_frame_counts    [XFE_ANIMATION_COMPASS]  = fe_anim_frames[XFE_ANIMATION_COMPASS*2];
  593.  
  594.     _small_animation_data    [XFE_ANIMATION_MOZILLA]  = anim_mozilla_small;
  595.     _large_animation_data    [XFE_ANIMATION_MOZILLA]  = anim_mozilla_large;
  596.     _animation_frame_counts    [XFE_ANIMATION_MOZILLA]  = fe_anim_frames[XFE_ANIMATION_MOZILLA*2];
  597. #endif /* NETSCAPE_PRIV */
  598.  
  599.     // Set at startup by ekit_LoadCustomAnimation()
  600.     if ( anim_custom_small && anim_custom_large ) {
  601.         _small_animation_data    [XFE_ANIMATION_CUSTOM]  = anim_custom_small;
  602.         _large_animation_data    [XFE_ANIMATION_CUSTOM]  = anim_custom_large;
  603.         _animation_frame_counts    [XFE_ANIMATION_CUSTOM]  = fe_anim_frames[XFE_ANIMATION_CUSTOM*2];
  604.     } else {
  605.         // This shouldn't happen, but just in case...
  606.         _small_animation_data    [XFE_ANIMATION_CUSTOM]  = anim_main_small;
  607.         _large_animation_data    [XFE_ANIMATION_CUSTOM]  = anim_main_large;
  608.         _animation_frame_counts    [XFE_ANIMATION_CUSTOM]  = fe_anim_frames[XFE_ANIMATION_MAIN*2];
  609.     }
  610.  
  611. }
  612. //////////////////////////////////////////////////////////////////////////
  613. void
  614. XFE_Logo::updatePixmaps()
  615. {
  616.     Pixmap *        pixmaps = NULL;
  617.     Cardinal        num_pixmaps = 0;
  618.  
  619.     switch(_size)
  620.     {
  621.     case XFE_ANIMATION_LARGE:
  622.  
  623.         if (!_large_animation_pixmaps[_type])
  624.         {
  625.             _large_animation_pixmaps[_type] =
  626.                 XFE_Logo::createAnimation(_frame,
  627.                                           m_widget,
  628.                                           _large_animation_data[_type],
  629.                                           _animation_frame_counts[_type]);
  630.         }
  631.  
  632.         pixmaps = _large_animation_pixmaps[_type];
  633.  
  634.         num_pixmaps = _animation_frame_counts[_type];
  635.         
  636.         break;
  637.  
  638.     case XFE_ANIMATION_SMALL:
  639.  
  640.         if (!_small_animation_pixmaps[_type])
  641.         {
  642.             _small_animation_pixmaps[_type] =
  643.                 XFE_Logo::createAnimation(_frame,
  644.                                           m_widget,
  645.                                           _small_animation_data[_type],
  646.                                           _animation_frame_counts[_type]);
  647.         }
  648.  
  649.         pixmaps = _small_animation_pixmaps[_type];
  650.  
  651.         num_pixmaps = _animation_frame_counts[_type];
  652.  
  653.         break;
  654.     }
  655.  
  656. #if 1
  657.     // Set the default 'rest' pixmap
  658.     XtVaSetValues(m_widget,
  659.                      XmNpixmap,                pixmaps[0],
  660.                   NULL);
  661.  
  662.     // Skip the first pixmap which is the default 'rest' pixmap
  663.     pixmaps++;
  664.     num_pixmaps--;
  665. #endif
  666.  
  667.     // Set the animation pixmaps
  668.     XtVaSetValues(m_widget,
  669.                      XmNanimationPixmaps,        pixmaps,
  670.                   XmNnumAnimationPixmaps,    num_pixmaps,
  671.                   NULL);
  672. }
  673. //////////////////////////////////////////////////////////////////////////
  674.  
  675. /* static */ void
  676. XFE_Logo::logoCallback(Widget /* w */,XtPointer clientData,XtPointer callData)
  677. {
  678.     XFE_Logo *                    logo = (XFE_Logo *) clientData;
  679.     XfeButtonCallbackStruct *    cbs = (XfeButtonCallbackStruct *) callData;
  680.  
  681.     XP_ASSERT( logo != NULL );
  682.  
  683.     switch(cbs->reason)
  684.     {
  685.     case XmCR_ARM:
  686.  
  687.         break;
  688.         
  689.     case XmCR_DISARM:
  690.         
  691.         break;
  692.     }
  693. }
  694. //////////////////////////////////////////////////////////////////////////
  695. XP_Bool
  696. XFE_Logo::processTraversal(XmTraversalDirection direction)
  697. {
  698.     if (m_widget && XfeIsAlive(m_widget) && 
  699.         XmProcessTraversal(m_widget,direction))
  700.     {
  701.         return True;
  702.     }
  703.  
  704.     return False;
  705. }
  706. //////////////////////////////////////////////////////////////////////////
  707.