Canola  0.8.D001
lib/program_card/functor/image.h
Go to the documentation of this file.
00001 //
00002 // canola - canon canola 1614p emulator
00003 // Copyright (C) 2011, 2012 Peter Miller
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, version 3, as
00007 // published by the Free Software Foundation.
00008 //
00009 // This program is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License along
00015 // with this program. If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 #ifndef LIB_PROGRAM_CARD_FUNCTOR_IMAGE_H
00019 #define LIB_PROGRAM_CARD_FUNCTOR_IMAGE_H
00020 
00021 #include <cairomm/context.h>
00022 
00023 #include <lib/program_card/functor.h>
00024 
00029 class program_card_functor_image:
00030     public program_card_functor
00031 {
00032 public:
00033     typedef boost::shared_ptr<program_card_functor_image> pointer;
00034 
00038     virtual ~program_card_functor_image();
00039 
00051     static pointer factory(const std::string &filename);
00052 
00053     // See base class for documentation.
00054     void set_disassemble(bool value);
00055 
00056 protected:
00061     program_card_functor_image();
00062 
00076     void draw(const Cairo::RefPtr<Cairo::Context> &cr,
00077         const unsigned char *data, size_t data_size);
00078 
00086     void draw_envelope(const Cairo::RefPtr<Cairo::Context> &cr);
00087 
00088     void set_position(int card_num, int card_count);
00089 
00090     // See base class for documentation.
00091     void set_title(const std::string &text);
00092 
00093     // See base class for documentation.
00094     void set_arrow(bool value);
00095 
00096     // See base class for documentation.
00097     void set_color(const std::string &text);
00098 
00099     // See base class for documentation.
00100     void set_perforations(bool value);
00101 
00102     // See base class for documentation.
00103     void set_trim_corners(bool value);
00104 
00105     // See base class for documentation.
00106     void set_style(const std::string &text);
00107 
00108     // See base class for documentation.
00109     virtual void set_sfj_list(const std::string &text);
00110 
00111     // See base class for documentation.
00112     virtual void set_fj_list(const std::string &text);
00113 
00114     // See base class for documentation.
00115     virtual void set_memory_list(const std::string &text);
00116 
00117     // See base class for documentation.
00118     virtual void set_steps(int value);
00119 
00120 private:
00125     bool trim_corners;
00126 
00132     bool perforations;
00133 
00139     bool disassemble;
00140 
00145     bool arrow;
00146 
00147     int card_num;
00148 
00149     int card_count;
00150 
00151     std::string color;
00152 
00153     std::string title;
00154 
00155     enum style_t
00156     {
00157         style_aus,
00158         style_ibm,
00159         style_blank
00160     };
00161 
00162     style_t style;
00163 
00164     std::string sfj_list;
00165     unsigned accuracy;
00166     unsigned step_count;
00167     std::string fj_list;
00168     std::string memory_list;
00169 
00170     void outline(const Cairo::RefPtr<Cairo::Context> &cr);
00171 
00179     program_card_functor_image(const program_card_functor_image &rhs);
00180 
00188     program_card_functor_image &operator=(
00189         const program_card_functor_image &rhs);
00190 };
00191 
00192 #endif // LIB_PROGRAM_CARD_FUNCTOR_IMAGE_H