Descent3/editor/PictListBox.h

107 lines
3.1 KiB
C
Raw Normal View History

/*
2024-06-15 18:12:48 +00:00
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
--- HISTORICAL COMMENTS FOLLOW ---
* $Logfile: /descent3/main/editor/PictListBox.h $
* $Revision: 1.1.1.1 $
* $Date: 2003-08-26 03:57:38 $
* $Author: kevinb $
*
* Editor Generic Picture List Box. You must declare your own custom
* box.
*
* $Log: not supported by cvs2svn $
2024-06-15 18:12:48 +00:00
*
* 4 4/02/97 12:21p Samir
* Moved some protected members to public to make list boxes more
* managable by parents.
2024-06-15 18:12:48 +00:00
*
* 3 3/18/97 12:12p Samir
* Parent window accessable to child classes.
2024-06-15 18:12:48 +00:00
*
* 2 2/25/97 1:24p Samir
* Made SelectItem a public.
*
* $NoKeywords: $
*/
// D3editor Pictoral ListBox Control
#ifndef PICTLISTBOX_H
#define PICTLISTBOX_H
#include "gr.h"
2024-06-15 18:12:48 +00:00
class editorPictListBox {
protected:
2024-06-15 18:12:48 +00:00
CWnd *m_ParentWnd;
private:
2024-06-15 18:12:48 +00:00
int m_StaticID;
int m_ScrollbarID;
RECT m_ListRect; // listbox rect
int m_ItemStart; // Initial item (not index into listbox, but into object list)
int m_ListPos; // Current position of textture list.
int m_PageLen; // length of one view of textures in listbox
int m_ItemsPerRow; // textures per row
int m_ItemsMaxRow; // maximum number of rows.
int m_ItemsMax;
bool m_Redraw;
int m_CheckX, m_CheckY, m_CheckForSelect;
int m_OldItemCount; // texture count saved from last update.
int m_ItemSelected; // currently selected texture.
int m_SurfDim;
private:
2024-06-15 18:12:48 +00:00
void ListDown(int rows);
void ListUp(int rows);
public:
2024-06-15 18:12:48 +00:00
editorPictListBox(); // constructor
2024-06-15 18:12:48 +00:00
// attach to a window. it will take over that window
void Create(CWnd *parent, int static_id, int scroll_id, int item_dim, int init_item);
void Invalidate(); // forces a redraw. (calls Update);
void SelectItem(int item);
int GetSelectedItem() const { return m_ItemSelected; };
int GetItemStart() const { return m_ItemStart; };
void SetItemStart(int start) { m_ItemStart = start; };
protected:
2024-06-15 18:12:48 +00:00
// Handlers
void SetItemMax(int max) { m_ItemsMax = max; };
public:
2024-06-15 18:12:48 +00:00
void OnLButtonDown(CPoint point); // called by parent window.
void OnVScroll(UINT nSBCode, int nPos, CScrollBar *pScrollBar);
2024-06-15 18:12:48 +00:00
// Handlers used by editorPictListBox.
protected:
2024-06-15 18:12:48 +00:00
virtual void StartIterateListItems() = 0;
virtual int NextListItem(int curitem) = 0;
virtual int PrevListItem(int curitem) = 0;
virtual void DrawItem(int x, int y, int item) = 0;
virtual void OnItemSelected(int item) = 0;
virtual void Update(); // updates the display of the listbox if needed.
protected:
2024-06-15 18:12:48 +00:00
grHardwareSurface m_ItemSurf, m_ItemSurfSel;
};
#endif