home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 Mobile / Chip_Mobile_2001.iso / palm / business / printcar / printcar.exe / src / PrintCardModel.h < prev    next >
C/C++ Source or Header  |  2000-06-10  |  2KB  |  83 lines

  1. //
  2. //  $Id: PrintCardModel.h,v 1.6 2000/06/10 00:19:44 sergey Exp $
  3. //
  4.  
  5. #ifndef _PrintCardModel_h_
  6. #define _PrintCardModel_h_
  7.  
  8. #include "Util/Serializable.h"
  9. #include "AddressList.h"
  10. #include "CardList.h"
  11. #include "PrintCardPreferences.h"
  12.  
  13. using namespace Util;
  14.  
  15. namespace UI    { class ListChoices; }
  16. namespace Util  { class InputStream; }
  17. namespace IrDA  { class Callback; }
  18.  
  19.  
  20. //
  21. //  Data model of the PrintCard application
  22. //
  23. class PrintCardModel: private Serializable
  24. {
  25. public:
  26.     PrintCardModel();
  27.     ~PrintCardModel();
  28.  
  29. private:
  30.     PrintCardModel(const PrintCardModel&);
  31.     PrintCardModel& operator =(const PrintCardModel&);
  32.  
  33. // operations
  34. public:
  35.     UI::ListChoices createNameChoices() const;
  36.     UI::ListChoices createCardChoices() const;
  37.  
  38.     // Changes position (nameIndex) when finds the record with requested first letter.
  39.     bool findNameByFirstLetter(char letter);
  40.  
  41.     // Returns card' preview image by it's index or 0 if no image was found.
  42.     BitmapPtr getPreviewImage() const;
  43.  
  44.     // Print selected card by its index. Pass callback reference as a parameter in order to
  45.     // receive notifications from the printing layer.
  46.     void print(IrDA::Callback& irCallback);
  47.  
  48. // attributes
  49.  
  50.     int namesIndex() const                  { return _namesIndex; }
  51.     void setNamesIndex(int index)           { _namesIndex = index; }
  52.  
  53.     int cardsIndex() const                  { return _cardsIndex; }
  54.     void setCardsIndex(int index)           { _cardsIndex = index; }
  55.  
  56.     const PrintCardPreferences& preferences() const  { return _preferences; }
  57.     PrintCardPreferences& preferences()              { return _preferences; }
  58.  
  59. // serialization interface
  60. private:
  61.     virtual void serialize(DataOutputStream& stream) const;
  62.     virtual void restore(const DataInputStream& stream);
  63.  
  64. // implementation
  65. private:
  66.     void loadPreferences();
  67.     void savePreferences();
  68.  
  69.     void printScript(IrDA::Callback& irCallback, const CardRecord& card);
  70.  
  71. // data memebars
  72. private:
  73.     int         _namesIndex;
  74.     int         _cardsIndex;
  75.  
  76.     AddressList _addressList;
  77.     CardList    _cardList;
  78.  
  79.     PrintCardPreferences _preferences;
  80. };
  81.  
  82. #endif  // _PrintCardModel_h_
  83.