apwindow.h

Go to the documentation of this file.
00001 #ifndef dismiswin_h
00002 #define dismiswin_h
00003 
00004 #include <InterViews/window.h>
00005 
00006 #include <InterViews/action.h>
00007 #include <InterViews/handler.h>
00008 #include <InterViews/observe.h>
00009 #include <OS/string.h>
00010 #include <ivstream.h>
00011 
00012 class Menu;
00013 class MenuItem;
00014 class OcGlyph;
00015 class DismissableWindow;
00016 class TopLevelWindow;
00017 class OcGlyphContainer;
00018 class PolyGlyph;
00019 
00020 // action for dismissing
00021 class WinDismiss : public Handler { //dismiss a Window
00022 public:
00023    WinDismiss(DismissableWindow*);
00024    virtual ~WinDismiss();
00025    virtual void execute(); //this can be replaced
00026    virtual boolean event(Event&);
00027    static void dismiss_defer();
00028 protected:
00029    DismissableWindow* win_;
00030 private:
00031    static DismissableWindow* win_defer_;
00032    static DismissableWindow* win_defer_longer_;
00033 };
00034 
00035 // Can be dismissed by window manager without quitting.
00036 // The style determines dynamically if this is transient or toplevel
00037 class DismissableWindow : public TransientWindow {
00038 public:
00039    DismissableWindow(Glyph*, boolean force_menubar = false);
00040    virtual ~DismissableWindow();
00041    virtual void dismiss();
00042    virtual const char* name() const;
00043    virtual void name(const char*);
00044    virtual void replace_dismiss_action(WinDismiss*);
00045    virtual Glyph* glyph() const {return glyph_;}
00046    virtual void configure();
00047    virtual void set_attributes();
00048    MenuItem* append_menubar(const char*); // return nil if no dismiss menubar
00049    
00050    static boolean is_transient() { return is_transient_; }
00051 private:
00052    Glyph* glyph_;
00053    WinDismiss* wd_;
00054    Action* dbutton_;
00055    static boolean is_transient_;
00056    Menu* menubar_;
00057 };
00058 
00059 
00060 // If you want to place a screen window onto a piece of paper
00061 class PrintableWindow : public DismissableWindow , public Observable {
00062 public:
00063    PrintableWindow(OcGlyph*);
00064    virtual ~PrintableWindow();
00065    virtual void map();
00066    virtual void unmap();
00067    virtual void hide();
00068    virtual boolean receive(const Event&);
00069    virtual void reconfigured();
00070    // The glyph the user actually wants printed
00071    virtual Glyph* print_glyph();
00072    // for size of what actually gets printed
00073    virtual Coord left_pw() const;
00074    virtual Coord bottom_pw() const;
00075    virtual Coord width_pw() const;
00076    virtual Coord height_pw() const;
00077    void type(const char*);
00078    const char* type() const;
00079    static OcGlyphContainer* intercept(OcGlyphContainer*); // instead of window put in a box
00080    virtual void map_notify();
00081    virtual void unmap_notify() {};
00082    virtual Coord save_left() const; // offset by window decoration
00083    virtual Coord save_bottom() const; // see nrn.defaults
00084    int xleft() const;
00085    int xtop() const;
00086    void xplace(int left, int top); // in x display pixel coords
00087    void xmove(int left, int top);
00088    void request_on_resize(boolean);
00089    static PrintableWindow* leader() { return leader_; }
00090    static void leader(PrintableWindow* w) { leader_ = w; }
00091 protected:
00092    virtual void default_geometry();
00093 private:
00094    CopyString type_;
00095    static OcGlyphContainer* intercept_;
00096    boolean mappable_;
00097    boolean xplace_;
00098    int xleft_;
00099    int xtop_;
00100    static PrintableWindow* leader_;
00101 };
00102 
00103 // canvas with hbox and menubar at top and left and right vboxes
00104 // the main glyph area resizes according to the window size.
00105 class StandardWindow : public PrintableWindow {
00106 public:
00107       StandardWindow(
00108         Glyph* main, Glyph* info=nil, Menu* m=nil, Glyph* l=nil, Glyph* r=nil
00109       );
00110    virtual ~StandardWindow();
00111    Menu* menubar();
00112    Glyph* canvas_glyph();
00113    Glyph* info();
00114    Glyph* lbox();
00115    Glyph* rbox();
00116 private:
00117    Menu* m_;
00118    Glyph* can_;
00119    Glyph* info_, *l_, *r_;
00120 };
00121 
00122 class PWMImpl;
00123 class JavaWindow;
00124 
00125 class PrintableWindowManager : public Observer {
00126 public:
00127    PrintableWindowManager();
00128    virtual ~PrintableWindowManager();
00129    void psfilter(const char* filename);
00130    void xplace(int, int, boolean map = true);
00131    static PrintableWindowManager* current();
00132 
00133    void append(PrintableWindow*);
00134    void remove(PrintableWindow*);
00135    void reconfigured(PrintableWindow*);
00136    void append(JavaWindow*);
00137    void remove(JavaWindow*);
00138    void reconfigured(JavaWindow*);
00139    void doprint();
00140 
00141    virtual void update(Observable*);
00142    virtual void disconnect(Observable*);
00143 public:
00144    PWMImpl* pwmi_;
00145 private:
00146    static PrintableWindowManager* current_;
00147 };
00148 
00149 #endif
Generated on Mon Jun 13 08:10:23 2011 for NEURON by  doxygen 1.6.3