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
|
//////////////////////////////////////////////////////////////////////////
//
// pgAdmin III - PostgreSQL Tools
//
// Copyright (C) 2002 - 2014, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
// ctlStackWindow.cpp - debugger
//
//////////////////////////////////////////////////////////////////////////
#include "pgAdmin3.h"
// wxWindows headers
#include <wx/wx.h>
#include <wx/listimpl.cpp>
// App headers
#include "debugger/ctlStackWindow.h"
WX_DEFINE_LIST(dbgStackFrameList);
IMPLEMENT_CLASS(ctlStackWindow, wxListBox)
////////////////////////////////////////////////////////////////////////////////
// ctlStackWindow constructor
//
// Initialize the grid control and clear it out....
//
ctlStackWindow::ctlStackWindow(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name )
: wxListBox(parent , id, pos, size, 0, NULL, style | wxLB_HSCROLL | wxLB_NEEDED_SB )
{
SetFont(settings->GetSystemFont());
}
////////////////////////////////////////////////////////////////////////////////
// ClearStack()
//
// Remove all stack frames from the display
//
void ctlStackWindow::ClearStack()
{
Set(0, NULL);
}
////////////////////////////////////////////////////////////////////////////////
// SetStack()
//
// Add an array of stack frames to the display
//
void ctlStackWindow::SetStack(const dbgStackFrameList &stacks, int selected)
{
Set(0, NULL);
for (dbgStackFrameList::Node *node = stacks.GetFirst(); node;
node = node->GetNext())
{
dbgStackFrame *frame = node->GetData();
Append(frame->GetDescription(), (wxClientData *)frame);
}
if (selected != -1)
{
SetSelection(selected);
}
}
////////////////////////////////////////////////////////////////////////////////
// SelectFrame()
//
// Select the frame based on the input function and package
//
void ctlStackWindow::SelectFrame(const wxString &pkg, const wxString &func)
{
int cnt = GetCount();
for (int idx = 0; idx < cnt; idx++)
{
dbgStackFrame *frame = (dbgStackFrame *)GetClientObject(idx);
if (frame && frame->GetFunction() == func && frame->GetPackage() == pkg)
{
SetSelection(idx);
return;
}
}
}
|