libyui

/data/gitorious.org/libyui/libyui-master/src/YApplication.h

00001 /**************************************************************************
00002 Copyright (C) 2000 - 2010 Novell, Inc.
00003 All Rights Reserved.
00004 
00005 This program is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation; either version 2 of the License, or
00008 (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License along
00016 with this program; if not, write to the Free Software Foundation, Inc.,
00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018 
00019 **************************************************************************/
00020 
00021 
00022 
00023 /*---------------------------------------------------------------------\
00024 |                                                                      |
00025 |                      __   __    ____ _____ ____                      |
00026 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00027 |                       \ V / _` \___ \ | |   __) |                    |
00028 |                        | | (_| |___) || |  / __/                     |
00029 |                        |_|\__,_|____/ |_| |_____|                    |
00030 |                                                                      |
00031 |                               core system                            |
00032 |                                                                      |
00033 |                                         (c) SuSE Linux Products GmbH |
00034 \----------------------------------------------------------------------/
00035 
00036   File:         YApplication.h
00037 
00038   Author:       Stefan Hundhammer <sh@suse.de>
00039 
00040 /-*/
00041 
00042 #ifndef YApplication_h
00043 
00044 #include <string>
00045 #include "YUI.h"
00046 #include "ImplPtr.h"
00047 #include "YMenuItem.h"
00048 #include  "YIconLoader.h"
00049 
00050 
00051 using std::string;
00052 
00053 class YWidget;
00054 class YWidgetID;
00055 class YApplicationPrivate;
00056 
00057 
00062 class YApplication
00063 {
00064 protected:
00065 
00066     friend class YUI;
00072     YApplication();
00073 
00077     virtual ~YApplication();
00078 
00079 public:
00080 
00088     YWidget * findWidget( YWidgetID * id, bool doThrow = true ) const;
00089 
00095     virtual string iconBasePath() const;
00096 
00100     virtual void setIconBasePath( const string & newIconBasePath );
00101 
00102     YIconLoader *iconLoader();
00103 
00124     int defaultFunctionKey( const string & label ) const;
00125 
00132     void setDefaultFunctionKey( const string & label, int fkey );
00133 
00137     void clearDefaultFunctionKeys();
00138 
00153     virtual void setLanguage( const string & language,
00154                               const string & encoding = string() );
00155 
00160     string language( bool stripEncoding = false ) const;
00161 
00183     virtual string glyph( const string & glyphSymbolName );
00184 
00199     virtual string askForExistingDirectory( const string & startDir,
00200                                             const string & headline ) = 0;
00201 
00218     virtual string askForExistingFile( const string & startWith,
00219                                        const string & filter,
00220                                        const string & headline ) = 0;
00221 
00240     virtual string askForSaveFileName( const string & startWith,
00241                                        const string & filter,
00242                                        const string & headline ) = 0;
00243 
00253     virtual bool openContextMenu( const YItemCollection & itemCollection );
00254 
00255 
00264     virtual void setProductName( const string & productName );
00265 
00269     string productName() const;
00270 
00277     virtual int deviceUnits( YUIDimension dim, float layoutUnits );
00278 
00285     virtual float layoutUnits( YUIDimension dim, int deviceUnits );
00286 
00293     virtual void setReverseLayout( bool reverse );
00294 
00299     bool reverseLayout() const;
00300 
00305     virtual void busyCursor() {}
00306 
00311     virtual void normalCursor() {}
00312 
00317     virtual void makeScreenShot( const string & fileName ) {}
00318 
00323     virtual void beep() {}
00324 
00325     
00326     //
00327     // NCurses (text mode) specific
00328     //
00329 
00334     virtual void redrawScreen() {}
00335 
00340     virtual void initConsoleKeyboard() {}
00341 
00348     virtual void setConsoleFont( const string & console_magic,
00349                                  const string & font,
00350                                  const string & screen_map,
00351                                  const string & unicode_map,
00352                                  const string & language )
00353         {}
00354 
00365     virtual int runInTerminal( const string & command );
00366 
00367 
00368     //
00369     // Display information.
00370     //
00371     // Width and height are returned in the the UI's native dimension:
00372     // Pixels for graphical UIs, character cells for text UIs.
00373     // -1 means "value cannot be obtained" for int functions.
00374     //
00375     // Derived classes are required to implement these functions.
00376     //
00377 
00378     virtual int  displayWidth()                 = 0;
00379     virtual int  displayHeight()                = 0;
00380     virtual int  displayDepth()                 = 0;
00381     virtual long displayColors()                = 0;
00382 
00383     // Size of main dialogs
00384     virtual int  defaultWidth()                 = 0;
00385     virtual int  defaultHeight()                = 0;
00386 
00387     //
00388     // UI capabilities
00389     //
00390 
00391     virtual bool isTextMode()                   = 0;
00392     virtual bool hasImageSupport()              = 0;
00393     virtual bool hasIconSupport()               = 0;
00394     virtual bool hasAnimationSupport()          = 0;
00395     virtual bool hasFullUtf8Support()           = 0;
00396     virtual bool richTextSupportsTable()        = 0;
00397     virtual bool leftHandedMouse()              = 0;
00398     virtual bool hasWizardDialogSupport() { return false; }
00399 
00400 
00401 private:
00402 
00403     ImplPtr<YApplicationPrivate> priv;
00404 
00405 };
00406 
00407 #define YApplication_h
00408 
00409 #endif // YApplication_h
 All Classes Functions Variables Enumerations Friends