Debian Codegraph @

editor/PictListBox.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Logfile: /descent3/main/editor/PictListBox.h $
21 * $Revision: 1.1.1.1 $
22 * $Date: 2003-08-26 03:57:38 $
23 * $Author: kevinb $
24 *
25 * Editor Generic Picture List Box. You must declare your own custom
26 * box.
27 *
28 * $Log: not supported by cvs2svn $
29 *
30 * 4 4/02/97 12:21p Samir
31 * Moved some protected members to public to make list boxes more
32 * managable by parents.
33 *
34 * 3 3/18/97 12:12p Samir
35 * Parent window accessable to child classes.
36 *
37 * 2 2/25/97 1:24p Samir
38 * Made SelectItem a public.
39 *
40 * $NoKeywords: $
41 */
42
43 // D3editor Pictoral ListBox Control
44
45 #ifndef PICTLISTBOX_H
46 #define PICTLISTBOX_H
47
48 #include "gr.h"
49
50 class editorPictListBox {
51 protected:
52 CWnd *m_ParentWnd;
53
54 private:
55 int m_StaticID;
56 int m_ScrollbarID;
57 RECT m_ListRect; // listbox rect
58 int m_ItemStart; // Initial item (not index into listbox, but into object list)
59 int m_ListPos; // Current position of textture list.
60 int m_PageLen; // length of one view of textures in listbox
61 int m_ItemsPerRow; // textures per row
62 int m_ItemsMaxRow; // maximum number of rows.
63 int m_ItemsMax;
64 bool m_Redraw;
65 int m_CheckX, m_CheckY, m_CheckForSelect;
66 int m_OldItemCount; // texture count saved from last update.
67 int m_ItemSelected; // currently selected texture.
68 int m_SurfDim;
69
70 private:
71 void ListDown(int rows);
72 void ListUp(int rows);
73
74 public:
75 editorPictListBox(); // constructor
76
77 // attach to a window. it will take over that window
78 void Create(CWnd *parent, int static_id, int scroll_id, int item_dim, int init_item);
79 void Invalidate(); // forces a redraw. (calls Update);
80 void SelectItem(int item);
81 int GetSelectedItem() const { return m_ItemSelected; };
82 int GetItemStart() const { return m_ItemStart; };
83 void SetItemStart(int start) { m_ItemStart = start; };
84
85 protected:
86 // Handlers
87 void SetItemMax(int max) { m_ItemsMax = max; };
88
89 public:
90 void OnLButtonDown(CPoint point); // called by parent window.
91 void OnVScroll(UINT nSBCode, int nPos, CScrollBar *pScrollBar);
92
93 // Handlers used by editorPictListBox.
94 protected:
95 virtual void StartIterateListItems() = 0;
96 virtual int NextListItem(int curitem) = 0;
97 virtual int PrevListItem(int curitem) = 0;
98 virtual void DrawItem(int x, int y, int item) = 0;
99 virtual void OnItemSelected(int item) = 0;
100 virtual void Update(); // updates the display of the listbox if needed.
101
102 protected:
103 grHardwareSurface m_ItemSurf, m_ItemSurfSel;
104 };
105
106 #endif