001    /*
002        Copyright (C) 2003 Adam Olsen
003    
004            This program is free software; you can redistribute it and/or modify
005        it under the terms of the GNU General Public License as published by
006        the Free Software Foundation; either version 1, or (at your option)
007        any later version.
008    
009        This program is distributed in the hope that it will be useful,
010        but WITHOUT ANY WARRANTY; without even the implied warranty of
011        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012        GNU General Public License for more details.
013    
014        You should have received a copy of the GNU General Public License
015        along with this program; if not, write to the Free Software
016        Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
017    */
018    
019    package com.valhalla.jbother.menus;
020    
021    import javax.swing.JMenuBar;
022    import com.valhalla.jbother.BuddyList;
023    
024    /**
025     * The menu that resides on the top of the BuddyList
026     * @author Adam Olsen
027     * @version 1.0
028    */
029    public class BuddyListTopMenu extends JMenuBar
030    {
031            private BuddyList blist;
032            BuddyListBuddiesMenu buddiesMenu = null;
033            SetStatusMenu statusMenu = null;
034    
035            /**
036             * Sets up the top menu
037             * @param blist the buddy list that this menu is attached to
038            */
039            public BuddyListTopMenu( BuddyList blist )
040            {
041                    this.blist = blist;
042    
043                    statusMenu = new SetStatusMenu( blist );
044                    buddiesMenu = new BuddyListBuddiesMenu( blist );
045                    if( System.getProperty( "mrj.version" ) == null ) add( statusMenu );
046                    add( buddiesMenu );
047                    if( System.getProperty( "mrj.version" ) != null ) add( statusMenu );
048                    if( System.getProperty( "mrj.version" ) == null ) add( new BuddyListHelpMenu() );
049            }
050    
051            /**
052             * @param var true if this is OS X
053            */
054            public void setOSX( boolean var )
055            {
056                    buddiesMenu.setOSX( var );
057            }
058    
059            /**
060             * Gets the status menu
061             * @return the SetStatusMenu
062            */
063            public SetStatusMenu getStatusMenu() {
064                    return statusMenu;
065            }
066    }