29 #include "../idlib/precompiled.h"
32 #include "../framework/Session_local.h"
41 static const int pixelOffset = 3;
44 static const int tabBorder = 4;
47 static const int doubleClickSpeed = 300;
103 int key =
event->evValue;
157 numLines = numVisibleLines / 2;
161 numLines = -numLines;
281 idStr strName = _name;
313 while (
src.ReadToken(&tok)) {
317 tabStops.
Append(atoi(tok));
323 while (
src.ReadToken(&tok)) {
327 tabAligns.
Append(atoi(tok));
334 while (
src.ReadToken(&tok)) {
338 tabVAligns.
Append(atoi(tok));
346 while (
src.ReadToken(&tok)) {
350 tabTypes.
Append(atoi(tok));
357 while (
src.ReadToken(&tok)) {
376 while (
src.ReadToken(&tok)) {
380 tabIconVOffsets.
Append(atof(tok));
384 int c = tabStops.
Num();
385 bool doAligns = (tabAligns.
Num() == tabStops.
Num());
386 for (
int i = 0;
i <
c;
i++) {
389 r.
w = (
i < c - 1) ? tabStops[
i+1] - r.
x - tabBorder : -1;
390 r.
align = (doAligns) ? tabAligns[
i] : 0;
391 if(tabVAligns.
Num() > 0) {
396 if(tabTypes.
Num() > 0) {
397 r.
type = tabTypes[
i];
401 if(tabSizes.
Num() > 0) {
406 if(tabIconVOffsets.
Num() > 0 ) {
425 const char *thumbImage =
"guis/assets/scrollbar_thumb.tga";
426 const char *barImage =
"guis/assets/scrollbarv.tga";
427 const char *scrollerName =
"_scrollerWinV";
430 barImage =
"guis/assets/scrollbarh.tga";
431 scrollerName =
"_scrollerWinH";
488 dc->
DrawRect(rect.
x, rect.
y + pixelOffset, rect.
w, rect.
h, 1.0f, color );
492 rect.
h = lineHeight - 1;
498 rect.
h = lineHeight + pixelOffset;
524 if ( work[0] !=
'\0' ) {
533 iconRect.
w =
tabInfo[tab].iconSize.x;
534 iconRect.
h =
tabInfo[tab].iconSize.y;
539 iconRect.
x = rect.
x + rect.
w/2.0f - iconRect.
w/2.0f;
541 iconRect.
x = rect.
x + rect.
w - iconRect.
w;
545 iconRect.
y = rect.
y +
tabInfo[tab].iconVOffset;
546 }
else if(
tabInfo[tab].valign == 1) {
547 iconRect.
y = rect.
y + rect.
h/2.0f - iconRect.
h/2.0f +
tabInfo[tab].iconVOffset;
548 }
else if(
tabInfo[tab].valign == 2) {
549 iconRect.
y = rect.
y + rect.
h - iconRect.
h +
tabInfo[tab].iconVOffset;
552 dc->
DrawMaterial(iconRect.
x, iconRect.
y, iconRect.
w, iconRect.
h, iconMat,
idVec4(1.0
f,1.0
f,1.0
f,1.0
f), 1.0
f, 1.0
f);
571 rect.
y += lineHeight;
572 if ( rect.
y > bottom ) {
616 if ( value < 0.0
f ) {
GLsizei const GLfloat * value
virtual void StateChanged(bool redraw=false)
int GetInt(const char *key, const char *defaultString="0") const
virtual void SetStateInt(const char *varName, const int value)
bool Contains(float x, float y)
idSliderWindow * scroller
GLenum GLenum GLenum GLenum GLenum scale
void InitWithDefaults(const char *_name, const idRectangle &rect, const idVec4 &foreColor, const idVec4 &matColor, const char *_background, const char *thumbShader, bool _vertical, bool _scrollbar)
virtual bool ParseInternalVar(const char *name, idParser *src)
virtual void HandleBuddyUpdate(idWindow *buddy)
virtual void Draw(int time, float x, float y)
void ParseString(idParser *src, idStr &out)
const char * GetName(void) const
const char * Left(int len, idStr &result) const
int GetImageHeight(void) const
GLuint GLuint GLsizei GLenum type
virtual bool ParseInternalVar(const char *name, idParser *src)
void PushClipRect(float x, float y, float w, float h)
virtual const idMaterial * FindMaterial(const char *name, bool makeDefault=true)=0
virtual const char * HandleEvent(const sysEvent_t *event, bool *updateVisuals)
int Icmp(const char *text) const
void SetValue(float _value)
virtual void Activate(bool activate, idStr &act)
int Icmpn(const char *text, int n) const
void Set(const char *key, Type &value)
GLuint GLuint GLsizei count
virtual void Activate(bool activate, idStr &act)
int DrawText(const char *text, float textScale, int textAlign, idVec4 color, idRectangle rectDraw, bool wrap, int cursor=-1, bool calcOnly=false, idList< int > *breaks=NULL, int limit=0)
const char * GetString(const char *key, const char *defaultString="") const
GLubyte GLubyte GLubyte GLubyte w
virtual void SetBuddy(idWindow *buddy)
void DrawFilledRect(float x, float y, float width, float height, const idVec4 &color)
const char * GetSourceFile(void) const
virtual idWinVar * GetWinVarByName(const char *_name, bool winLookup=false, drawWin_t **owner=NULL)
type * Find(type const &obj) const
virtual const idDict & State() const
void InitScroller(bool horizontal)
idDeclManager * declManager
bool Get(const char *key, Type **value=NULL) const
virtual sysEvent_t GenerateMouseButtonEvent(int button, bool down)=0
int Append(const type &obj)
GLdouble GLdouble GLdouble r
void ClearSelection(int sel)
idUserInterfaceLocal * gui
void SetCurrentSel(int sel)
void Append(const char a)
bool RemoveIndex(int index)
bool IsSelected(int index)
int GetImageWidth(void) const
const char * c_str(void) const
bool InsertChild(idWindow *win, idWindow *before)
void AddCurrentSel(int sel)
bool TestMaterialFlag(const int flag) const
void SetSort(float s) const
idList< idTabRect > tabInfo
int FindIndex(const type &obj) const
void SetImageClassifications(int tag) const
void SetRange(float _low, float _high, float _step)
char * va(const char *fmt,...)
virtual const char * HandleEvent(const sysEvent_t *event, bool *updateVisuals)
void DrawMaterial(float x, float y, float w, float h, const idMaterial *mat, const idVec4 &color, float scalex=1.0, float scaley=1.0)
idHashTable< const idMaterial * > iconMaterials
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
virtual idWinVar * GetWinVarByName(const char *_name, bool winLookup=false, drawWin_t **owner=NULL)
idListWindow(idUserInterfaceLocal *gui)
void DrawRect(float x, float y, float width, float height, float size, const idVec4 &color)
static bool CharIsPrintable(int c)