This repository has been archived on 2023-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
MyGameFramework/lib/gwen/controls/gwen_listbox.h
Gered c5cdddbeaa initial commit
current versions of all of my basic framework sources, build configurations/scripts, and supporting assets
2013-01-31 12:53:05 -05:00

72 lines
1.7 KiB
C++

/*
GWEN
Copyright (c) 2010 Facepunch Studios
See license in Gwen.h
*/
#pragma once
#ifndef GWEN_CONTROLS_LISTBOX_H
#define GWEN_CONTROLS_LISTBOX_H
#include "../gwen.h"
#include "layout/gwen_table.h"
#include "gwen_scrollcontrol.h"
namespace Gwen
{
namespace Controls
{
class ScrollControl;
class GWEN_EXPORT ListBox : public ScrollControl
{
public:
GWEN_CONTROL( ListBox, ScrollControl );
typedef stl::list<Layout::TableRow*> Rows;
Layout::TableRow* AddItem( const TextObject& strLabel, const String& strName = "" );
void RemoveItem( Layout::TableRow * row );
void Render( Skin::Base* skin );
void Layout( Skin::Base* skin );
void UnselectAll();
void SetAllowMultiSelect( bool bMultiSelect ){ m_bMultiSelect = bMultiSelect; }
bool AllowMultiSelect() const { return m_bMultiSelect; }
const ListBox::Rows& GetSelectedRows(){ return m_SelectedRows; }
virtual Layout::TableRow* GetSelectedRow();
virtual Gwen::String GetSelectedRowName();
virtual void SetSelectedRow( Gwen::Controls::Base* pRow, bool bClearOthers = true );
virtual void SelectByString( const TextObject& string, bool bClearOthers = true );
Gwen::Event::Caller onRowSelected;
Controls::Layout::Table* GetTable() { return m_Table; }
virtual void Clear();
// Pass through, to embedded table
void SetColumnCount( int iCount ) { m_Table->SetColumnCount( iCount ); }
void SetColumnWidth( int iCount, int iSize ) { m_Table->SetColumnWidth( iCount, iSize ); }
protected:
void OnRowSelected( Base* pControl );
Controls::Layout::Table* m_Table;
ListBox::Rows m_SelectedRows;
bool m_bMultiSelect;
};
}
}
#endif