moved almost all hardcoded constants to "define.dat"
[k8-i-v-a-n.git] / src / felib / felist.h
blob10fb7483946630fe3efdfffcded30fbea6eaa7c8
1 /*
3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
6 * Public License
8 * See LICENSING which should be included
9 * along with this file for more details
12 #ifndef __FELIB_LIST_H__
13 #define __FELIB_LIST_H__
15 #include <vector>
17 #include "v2.h"
18 #include "festring.h"
21 class outputfile;
22 class inputfile;
23 class rawbitmap;
24 class bitmap;
25 class festring;
26 struct felistentry;
27 struct felistdescription;
30 typedef void (*entrydrawer) (bitmap *Bitmap, v2 Pos, uInt);
32 class felist {
33 public:
34 felist (cfestring &Topic, col16 TopicColor=WHITE, uInt Maximum=0);
35 ~felist ();
36 void AddEntry (cfestring &Str, col16 Color, uInt Marginal=0, uInt Key=NO_IMAGE, truth Selectable=true, feuLong udata=0);
37 void AddDescription (cfestring &Str, col16 Color=WHITE);
38 uInt Draw ();
39 void QuickDraw (bitmap *Bitmap, uInt PageLength) const;
40 void Empty ();
41 void EmptyDescription () { Description.resize(1); }
42 void Load (inputfile &SaveFile);
43 void Save (outputfile &SaveFile) const;
44 uInt GetSelected () const { return Selected; }
45 void SetSelected (uInt What) { Selected = What; }
46 void EditSelected (int What) { Selected += What; }
47 truth DrawPage (bitmap *Bitmap) const;
48 void Pop ();
49 static void CreateQuickDrawFontCaches (rawbitmap *Font, col16 Color, uInt PageLength);
50 void PrintToFile (cfestring &SaveFile);
51 void SetPos (v2 What) { Pos = What; }
52 void SetWidth (uInt What) { Width = What; }
53 void SetPageLength (uInt What) { PageLength = What; }
54 void SetBackColor (col16 What) { BackColor = What; }
55 void SetFlags (uInt What) { Flags = What; }
56 void AddFlags (uInt What) { Flags |= What; }
57 void RemoveFlags (uInt What) { Flags &= ~What; }
58 void SetUpKey (uInt What) { UpKey = What; }
59 void SetDownKey (uInt What) { DownKey = What; }
60 void SetEntryDrawer (entrydrawer What) { EntryDrawer = What; }
61 truth IsEmpty () const { return Entry.empty(); }
62 uInt GetLength () const { return Entry.size(); }
63 uInt GetLastEntryIndex () const { return Entry.size()-1; }
64 festring GetEntry (uInt I) const;
65 truth IsEntrySelectable (uInt idx) const;
66 feuLong GetEntryUData (uInt idx) const;
67 void SetEntryUData (uInt idx, feuLong udata);
68 col16 GetColor (uInt I) const;
69 void SetColor (uInt I, col16 What);
71 static truth GetFastListMode ();
72 static void SetFastListMode (truth modeon);
74 truth isSaveSelector () const { return mSaveSelector; }
75 void ResetSaveSelector () { mSaveSelector = false; }
76 void SetSaveSelector (cfestring &dir) { mSaveDir = dir; mSaveSelector = true; }
78 private:
79 void DrawDescription (bitmap *Bitmap) const;
81 private:
82 truth mSaveSelector;
83 festring mSaveDir;
84 std::vector<felistentry *> Entry;
85 std::vector<felistdescription *> Description;
86 uInt PageBegin;
87 uInt Maximum;
88 uInt Selected;
89 v2 Pos;
90 uInt Width;
91 uInt PageLength;
92 col16 BackColor;
93 uInt Flags;
94 uInt UpKey;
95 uInt DownKey;
96 entrydrawer EntryDrawer;
100 #endif