Back to index

texmacs  1.0.7.15
aqua_widget.h
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : aqua_widget.h
00004 * DESCRIPTION: Aqua widget class
00005 * COPYRIGHT  : (C) 2007  Massimiliano Gubinelli
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef AQUA_WIDGET_H
00013 #define AQUA_WIDGET_H
00014 
00015 #include "widget.hpp"
00016 
00017 #ifndef MAC_COCOA_H
00018 typedef struct TeXmacs_NSView {
00019   void * isa;
00020 }  NSView ; // hack to allow inclusion in pure C++ sources
00021 //#else
00022 //typedef NSView * NSViewPtr ; 
00023 typedef void *TMMenuItem;
00024 #else
00025 @class TMMenuItem;
00026 #endif
00027 
00028 
00029 class aqua_widget_rep : public widget_rep {
00030 public:
00031        aqua_widget_rep() : widget_rep () { };
00032        
00033        virtual widget plain_window_widget (string s); 
00034        virtual widget make_popup_widget (); 
00035        virtual widget popup_window_widget (string s); 
00036  
00037   virtual TMMenuItem *as_menuitem();
00038 
00039 };
00040 
00041 
00042 
00043 
00044 class aqua_view_widget_rep: public aqua_widget_rep {
00045 public:       
00046        NSView *view;
00047 
00048 public:
00049   aqua_view_widget_rep (NSView *v);
00050   ~aqua_view_widget_rep ();
00051 
00052     virtual void send (slot s, blackbox val);
00053     // send a message val to the slot s
00054   virtual blackbox query (slot s, int type_id);
00055     // obtain information of a given type from the slot s
00056   virtual widget read (slot s, blackbox index);
00057     // abstract read access (of type s) of a subwidget at position index
00058   virtual void write (slot s, blackbox index, widget w);
00059     // abstract write access (of type s) of a subwidget at position index
00060   virtual void notify (slot s, blackbox new_val);
00061     // notification of a change on a slot s which contains a state variable
00062 //  virtual void connect (slot s, widget w2, slot s2);
00063     // connect a state slot s to another slot s2 of another widget w2
00064 //  virtual void deconnect (slot s, widget w2, slot s2);
00065     // deconnect a state slot s from another slot s2 of another widget w2
00066 
00067        virtual widget plain_window_widget (string s); 
00068 
00069 };
00070 
00071 class aqua_widget {
00072 public:
00073        ABSTRACT_NULL(aqua_widget);
00074   inline bool operator == (aqua_widget w) { return rep == w.rep; }
00075   inline bool operator != (aqua_widget w) { return rep != w.rep; }
00076 };
00077 ABSTRACT_NULL_CODE(aqua_widget);
00078 
00079 inline widget abstract (aqua_widget w) { return widget (w.rep); }
00080 inline aqua_widget concrete (widget w) { return aqua_widget ((aqua_widget_rep*) w.rep); }
00081 
00082 extern widget the_keyboard_focus;
00083 
00084 #endif // defined AQUA_WIDGET_H