File: ctlVarWindow.h

package info (click to toggle)
pgadmin3 1.20.0~beta2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 73,704 kB
  • ctags: 18,591
  • sloc: cpp: 193,786; ansic: 18,736; sh: 5,154; pascal: 1,120; yacc: 927; makefile: 516; lex: 421; xml: 126; perl: 40
file content (80 lines) | stat: -rw-r--r-- 2,474 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// ctlVarWindow.h - debugger
//
//////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
//	class ctlVarWindow
//
//	This class implements the window that displays PL variable values at the
//  bottom of the debugger window.  When we create a ctlVarWindow, the parent
//	is a ctlTabWindow (the ctlVarWindow becomes a tab in a tab control).
//
//	It is a simple grid control - the grid contains three columns:
//		the RowLabel column displays the name of each variable
//		column 0 displays the value of each variable
//		column 1 displays the data type of each variable
//
//	Each ctlVarWindow contains a hash map that can locate a grid cell given a
//  variable name
//
////////////////////////////////////////////////////////////////////////////////

#ifndef CTLVARWINDOW_H
#define CTLVARWINDOW_H

#include <wx/hashmap.h>
#include <wx/hashset.h>
#include <wx/grid.h>

class ctlVarWindow : public wxGrid
{
	DECLARE_CLASS(ctlVarWindow)

public:
	ctlVarWindow(wxWindow *parent, wxWindowID id);

	// Add a variable to the window
	void AddVar(wxString name, wxString value, wxString type, bool readOnly);
	// Remove a variable from the window
	void DelVar(wxString name = wxEmptyString);

	wxString GetVarName(int row);
	wxString GetVarValue(int row);

private:

	// The content of a grid cell is defined by the gridCell structure
	typedef struct
	{
		int      m_row;   // Row number for this variable/grid cell
		wxString m_value; // Variable value
		wxString m_type;  // Variable type
	} gridCell;

	enum
	{
	    COL_NAME = 0,		// Column 0 contains the variable name
	    COL_TYPE,		// This column contains the variable type
	    COL_VALUE		// This column contains the variable value
	};

	// The m_cells hash translates variable names into gridCell references
public:
	WX_DECLARE_STRING_HASH_MAP(gridCell, wsCellHash);
	WX_DECLARE_HASH_SET(wxString, wxStringHash, wxStringEqual, wsStringSet);

private:
	wsStringSet	m_hiddenNames;	// List of hidden variable names
	wsStringSet	m_hiddenTypes;	// List of hidden variable types
	wsCellHash	*m_cells;	// name-to-gridCell map
	wxFont		m_nameFont;	// Font used to display field names
};

#endif