• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

xap_CocoaWindow.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiSource Program Utilities
00004  * Copyright (C) 2002 Francis James Franklin <fjf@alinameridon.com>
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00019  * 02111-1307, USA.
00020  */
00021 
00022 #ifndef XAP_COCOAWINDOW_H
00023 #define XAP_COCOAWINDOW_H
00024 
00025 #import <Cocoa/Cocoa.h>
00026 
00027 /* pre-emptive dismissal; ut_types.h is needed by just about everything,
00028  * so even if it's commented out in-file that's still a lot of work for
00029  * the preprocessor to do...
00030  */
00031 #ifndef UT_TYPES_H
00032 #include "ut_types.h"
00033 #endif
00034 
00035 class XAP_CocoaWindow
00036 {
00037 public:
00038     enum WindowStyle
00039     {
00040         ws_Normal = 0,
00041         ws_Raw, // i.e., no decorations; use by toolbar window
00042         ws_Frame,
00043         ws_Panel
00044     };
00045     enum WindowError
00046     {
00047         we_NoController,
00048         we_NoWindow
00049     };
00050 
00051 protected:
00052     XAP_CocoaWindow (WindowStyle ws, const NSRect & frameRect);
00053     XAP_CocoaWindow (); // special case for document/frame
00054     XAP_CocoaWindow (float height); // special case for toolbar
00055 private:
00056     void _init (WindowStyle ws);
00057 public:
00058     virtual ~XAP_CocoaWindow ();
00059 
00060     /* callback notification of main-window resize
00061      */
00062     virtual void            _windowResized ();
00063 
00064 protected:
00065     void                    _show (); // this should be called only from the child's constructor, I think
00066 
00067     void                    _moveto (const NSPoint & position);
00068 
00069     void                    _resize (const NSSize & size);
00070     void                    _resize (float height); // special case for toolbar
00071 
00072 protected:
00073     unsigned int            m_styleMask;
00074 
00075     NSBackingStoreType      m_backingType;
00076     NSWindowController *    m_controller;
00077     NSWindow *              m_window;
00078     bool                    m_isToolbar;
00079     NSRect                  m_frame;
00080 };
00081 
00082 #endif /* ! XAP_COCOAWINDOW_H */

Generated on Mon May 28 2012 for AbiWord by  doxygen 1.7.1