view.h

来自「A Library of Efficient Data Types and Al」· C头文件 代码 · 共 170 行

H
170
字号
/*******************************************************************************++  LEDA 4.5  +++  view.h+++  Copyright (c) 1995-2004+  by Algorithmic Solutions Software GmbH+  All rights reserved.+ *******************************************************************************/// $Revision: 1.3 $  $Date: 2004/02/06 11:18:30 $#ifndef VIEW_H#define VIEW_H#include <LEDA/map.h>#include <LEDA/anim/view_base.h>LEDA_BEGIN_NAMESPACE//---------------------------------------------------------------------------// class view// ---------------------------------------------------------------------------/*{\Manpage {view} {} {View}}*//*{\Mdefinition}*/class view { protected:  struct redraw_handler : public window_handler  { view& V;        redraw_handler(view& v) : V(v) {}            void operator()()     { window& W = V.get_window();            W.start_buffering();      W.clear();            { elem_item it;        forall(it,V.Elems) it->redraw();                              }                  { list<action_item> L;         forall(L,V.Action)         { action_item it;          forall(it,L) it->redraw();        }      }            W.flush_buffer();      W.stop_buffering();    }  };       redraw_handler redraw_h;    friend struct view::redraw_handler;  window W;    list<elem_item> Elems;  list<anim_item> Anims;    map<window*,list<action_item> >Action;      action_item Menu;  action_item StdAction;  int    max_steps;  bool   first_step;    double scale_factor;    int    sleep_time;  // time in msec  double listen_time;    bool listen();    void set_listen_time();    public:    view(string label = "View");  view(int w, int h, string label = "View"); ~view();       void draw() { W.redraw(); }    void win_init(double x0, double x1, double y0);    double  get_scale_factor() const;    window& get_window() { return W; }   void display();  void display(int x, int y);  void close();      void add_element(base_element&);  void del_element(base_element&);      list<elem_item>& all_elements() { return Elems; }    bool is_member(base_element&);          void scene_begin(int = 0);  void add_animation(anim_item);    int  scene_end();      void scene_step(int = 1);  void scene_finish();  void scene_play();    int  set_delay(int);  int  get_delay() const;  bool wait();  bool wait(int);    void add_action(action_item);  void del_action(action_item);      void focus(base_element&) {}  void unfocus() {}  double xmin() const;  double xmax() const;  double ymin() const;  double ymax() const;};class standard_view_menu : public base_action{ view&   V;  window* M;      public:      standard_view_menu(view& v);  ~standard_view_menu() { delete M; }      void redraw();    int handle_event(int event, int but, double x, double y);    window* get_window() const { return M; }};class standard_view_action : public base_action{ view& V;    public:  standard_view_action(view& v) : V(v) {}     int handle_event(int event, int but, double x, double y);    window* get_window() const { return &V.get_window(); }  };LEDA_END_NAMESPACE#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?