mirror of
https://github.com/FWGS/hlsdk-xash3d
synced 2024-11-22 18:05:23 +01:00
ba2cab60df
* Get VGUI back (optionally) * Add some missing VGUI invocations * Update CMakeLists.txt to build with vgui for Windows * Move windows.h inclusions only to those places where it's really needed * Try fix mingw build * Update hud_spectator * Merge nekonomicon's vgui branch * Don't include vgui panel and app in cdll_int.cpp if vgui is real * Deduplicate scoreboard global variables * Add options to prefer non-vgui motd and scoreboard when vgui is enabled * Add vgui-dev as a submodule. Add building vith vgui to CI * Fix artifact uploading * Don't use global variable when not necessary * char* to const char* in CMenuHandler_StringCommand constructor * Fix 'format string is not a literal string' warnings * Fix 'always evaluate to true' warnings * Team Fortress classes to const char* * CreateCommandMenu accepts const char* * Fix printf formats. Turn some unsigned longs into unsigned ints since they use only 32 bits anyway * Explicit assignment result as condition * Prevent memory leak on menu reading * Localize button text * Create FileInputStream on stack avoiding the leak * Remove Servers Browser code * Arrow file names to const char* * Fix assignment to the wrong variable
97 lines
2.3 KiB
C++
97 lines
2.3 KiB
C++
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
|
|
//
|
|
// Purpose:
|
|
//
|
|
// $NoKeywords: $
|
|
//=============================================================================
|
|
#pragma once
|
|
#ifndef VOICE_LISTBOX_H
|
|
#define VOICE_LISTBOX_H
|
|
|
|
#include "VGUI_Panel.h"
|
|
#include "VGUI_IntChangeSignal.h"
|
|
|
|
#include "vgui_slider2.h"
|
|
#include "vgui_scrollbar2.h"
|
|
|
|
namespace vgui
|
|
{
|
|
// Listbox class used by voice code. Based off of vgui's list panel but with some modifications:
|
|
// - This listbox clips its child items to its rectangle.
|
|
// - You can access things like the scrollbar and find out the item width.
|
|
// - The scrollbar scrolls one element at a time and the range is correct.
|
|
|
|
// Note: this listbox does not provide notification when items are
|
|
class CListBox : public Panel
|
|
{
|
|
public:
|
|
CListBox();
|
|
~CListBox();
|
|
|
|
void Init();
|
|
void Term();
|
|
|
|
// Add an item to the listbox. This automatically sets the item's parent to the listbox
|
|
// and resizes the item's width to fit within the listbox.
|
|
void AddItem( Panel *pPanel );
|
|
|
|
// Get the number of items currently in the listbox.
|
|
int GetNumItems();
|
|
|
|
// Get the width that listbox items will be set to (this changes if you resize the listbox).
|
|
int GetItemWidth();
|
|
|
|
// Get/set the scrollbar position (position says which element is at the top of the listbox).
|
|
int GetScrollPos();
|
|
void SetScrollPos( int pos );
|
|
|
|
// sets the last item the listbox should scroll to
|
|
// scroll to GetNumItems() if not set
|
|
void SetScrollRange( int maxScroll );
|
|
|
|
// returns the maximum value the scrollbar can scroll to
|
|
int GetScrollMax();
|
|
|
|
// vgui overrides.
|
|
virtual void setPos( int x, int y );
|
|
virtual void setSize( int wide, int tall );
|
|
virtual void setPixelScroll( int value );
|
|
virtual void paintBackground();
|
|
protected:
|
|
class LBItem
|
|
{
|
|
public:
|
|
Panel *m_pPanel;
|
|
LBItem *m_pPrev, *m_pNext;
|
|
};
|
|
|
|
class ListBoxSignal : public IntChangeSignal
|
|
{
|
|
public:
|
|
void intChanged( int value, Panel *panel )
|
|
{
|
|
m_pListBox->setPixelScroll( -value );
|
|
}
|
|
|
|
vgui::CListBox *m_pListBox;
|
|
};
|
|
|
|
void InternalLayout();
|
|
|
|
// All the items..
|
|
LBItem m_Items;
|
|
|
|
Panel m_ItemsPanel;
|
|
|
|
int m_ItemOffset; // where we're scrolled to
|
|
Slider2 m_Slider;
|
|
ScrollBar2 m_ScrollBar;
|
|
ListBoxSignal m_Signal;
|
|
|
|
int m_iScrollMax;
|
|
};
|
|
|
|
}
|
|
#endif // VOICE_LISTBOX_H
|
|
|