File: ctlTabWindow.cpp

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 (175 lines) | stat: -rw-r--r-- 4,826 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// ctlTabWindow.cpp - debugger
//
//////////////////////////////////////////////////////////////////////////

#include "pgAdmin3.h"

// wxWindows headers
#include <wx/wx.h>
#include <wx/thread.h>

// App headers
#include "ctl/ctlAuiNotebook.h"
#include "debugger/ctlTabWindow.h"
#include "debugger/dbgConst.h"


IMPLEMENT_CLASS(ctlTabWindow, wxWindow)

////////////////////////////////////////////////////////////////////////////////
// ctlTabWindow constructor
//
//    This constructor creates a new notebook (a tab control) and clears out the
//  rest of the data members.
//
ctlTabWindow::ctlTabWindow(wxWindow *parent, wxWindowID id, const wxPoint &pos,
                           const wxSize &size, long style, const wxString &name)
	: ctlAuiNotebook(parent, id, pos, size, style),
	  m_resultWindow(NULL),
	  m_varWindow(NULL),
	  m_pkgVarWindow(NULL),
	  m_stackWindow(NULL),
	  m_paramWindow(NULL),
	  m_messageWindow(NULL)
{
	SetFont(settings->GetSystemFont());
	m_tabMap   = new wsTabHash();
}

void ctlTabWindow::SelectTab(wxWindowID id)
{
	wsTabHash::iterator result = m_tabMap->find(id);

	if (result != m_tabMap->end())
	{
		SetSelection(result->second);
	}
}

////////////////////////////////////////////////////////////////////////////////
// GetResultWindow()
//
//    This function returns a pointer to our child result window (m_resultWindow)
//  and creates that window when we first need it.
//
ctlResultGrid *ctlTabWindow::GetResultWindow()
{
	if (m_resultWindow == 0)
	{
		// We don't have a result window yet - go ahead and create one

		m_resultWindow = new ctlResultGrid(this, -1);
		AddPage(m_resultWindow, _("Results"), true);
	}

	return m_resultWindow;
}

////////////////////////////////////////////////////////////////////////////////
// GetVarWindow()
//
//    This function returns a pointer to our child 'local-variables' window
//  (m_varWindow) and creates that window when we first need it.
//
ctlVarWindow *ctlTabWindow::GetVarWindow(bool _create)
{
	if ((m_varWindow == NULL) && _create)
	{
		// We don't have a variable window yet - go ahead and create one

		(*m_tabMap)[ID_VARGRID] = GetPageCount();

		m_varWindow = new ctlVarWindow(this, ID_VARGRID);
		AddPage(m_varWindow, _("Local Variables"), true);
	}

	return m_varWindow;
}

////////////////////////////////////////////////////////////////////////////////
// GetPkgVarWindow()
//
//  This function returns a pointer to our child 'package-variables' window
//  (m_varWindow) and creates that window when we first need it.
//
ctlVarWindow *ctlTabWindow::GetPkgVarWindow(bool create)
{
	if ((m_pkgVarWindow == NULL) && create)
	{
		// We don't have a variable window yet - go ahead and create one

		(*m_tabMap)[ID_PKGVARGRID] = GetPageCount();

		m_pkgVarWindow = new ctlVarWindow(this, ID_PKGVARGRID);
		AddPage(m_pkgVarWindow, _("Package Variables"), true);
	}

	return m_pkgVarWindow;
}

////////////////////////////////////////////////////////////////////////////////
// GetParamWindow()
//
//    This function returns a pointer to our child 'parameters' window
//  (m_paramWindow) and creates that window when we first need it.
//
ctlVarWindow *ctlTabWindow::GetParamWindow(bool create)
{
	if ((m_paramWindow == NULL) && create)
	{
		// We don't have a variable window yet - go ahead and create one

		(*m_tabMap)[ID_PARAMGRID] = GetPageCount();

		m_paramWindow = new ctlVarWindow(this, ID_PARAMGRID);
		AddPage(m_paramWindow, _("Parameters"), true);
	}

	return m_paramWindow;
}

////////////////////////////////////////////////////////////////////////////////
// GetMessageWindow()
//
//    This function returns a pointer to our child 'messages' window
//  (m_messageWindow) and creates that window when we first need it.
//
ctlMessageWindow *ctlTabWindow::GetMessageWindow()
{
	if (m_messageWindow == 0)
	{
		// We don't have a variable window yet - go ahead and create one

		(*m_tabMap)[ID_MSG_PAGE] = GetPageCount();

		m_messageWindow = new ctlMessageWindow(this, ID_MSG_PAGE);
		AddPage(m_messageWindow, _("DBMS Messages"), true);
	}
	return m_messageWindow;
}

////////////////////////////////////////////////////////////////////////////////
// GetStackWindow()
//
//    This function returns a pointer to our child stack-trace window
//  (m_stackWindow) and creates that window when we first need it.
//
ctlStackWindow *ctlTabWindow::GetStackWindow()
{
	if (m_stackWindow == 0)
	{
		// We don't have a stack-trace window yet - go ahead and create one
		m_stackWindow = new ctlStackWindow(this, -1);
		AddPage(m_stackWindow, _("Stack"), true);
	}

	return m_stackWindow;
}