Initial implementation of exception configuration window.

Doesn't actually take any actions yet, just presents a UI.
This commit is contained in:
Rene Gollent 2013-06-13 20:39:06 -04:00
parent 6121ae660c
commit 55fc8da143
4 changed files with 165 additions and 0 deletions

View File

@ -234,6 +234,7 @@ Application Debugger :
# user_interface/gui/team_window
BreakpointListView.cpp
BreakpointsView.cpp
ExceptionConfigWindow.cpp
ImageFunctionsView.cpp
ImageListView.cpp
RegistersView.cpp

View File

@ -52,6 +52,8 @@ enum {
MSG_TEAM_RESTART_REQUESTED = 'trrq',
MSG_SHOW_TEAMS_WINDOW = 'stsw',
MSG_TEAMS_WINDOW_CLOSED = 'tswc',
MSG_SHOW_EXCEPTION_CONFIG_WINDOW = 'secw',
MSG_EXCEPTION_CONFIG_WINDOW_CLOSED = 'ecwc',
MSG_START_NEW_TEAM = 'sttt',
MSG_DEBUG_THIS_TEAM = 'dbtt',
MSG_SHOW_INSPECTOR_WINDOW = 'sirw',

View File

@ -0,0 +1,112 @@
/*
* Copyright 2013, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#include "ExceptionConfigWindow.h"
#include <Button.h>
#include <CheckBox.h>
#include <LayoutBuilder.h>
#include "MessageCodes.h"
#include "UserInterface.h"
#include "Team.h"
enum {
MSG_STOP_ON_THROWN_EXCEPTION_CHANGED = 'stec',
MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED = 'scec'
};
ExceptionConfigWindow::ExceptionConfigWindow(::Team* team,
UserInterfaceListener* listener, BHandler* target)
:
BWindow(BRect(), "Configure Exceptions", B_FLOATING_WINDOW,
B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE),
fTeam(team),
fListener(listener),
fExceptionThrown(NULL),
fExceptionCaught(NULL),
fCloseButton(NULL),
fTarget(target)
{
}
ExceptionConfigWindow::~ExceptionConfigWindow()
{
BMessenger(fTarget).SendMessage(MSG_EXCEPTION_CONFIG_WINDOW_CLOSED);
}
ExceptionConfigWindow*
ExceptionConfigWindow::Create(::Team* team,
UserInterfaceListener* listener, BHandler* target)
{
ExceptionConfigWindow* self = new ExceptionConfigWindow(team, listener,
target);
try {
self->_Init();
} catch (...) {
delete self;
throw;
}
return self;
}
void
ExceptionConfigWindow::_Init()
{
BLayoutBuilder::Group<>(this, B_VERTICAL)
.SetInsets(B_USE_DEFAULT_SPACING)
.Add(fExceptionThrown = new BCheckBox("exceptionThrown",
"Stop when an exception is thrown", new BMessage(
MSG_STOP_ON_THROWN_EXCEPTION_CHANGED)))
.Add(fExceptionCaught = new BCheckBox("exceptionCaught",
"Stop when an exception is caught", new BMessage(
MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED)))
.AddGroup(B_HORIZONTAL, 4.0f)
.AddGlue()
.Add(fCloseButton = new BButton("Close", new BMessage(
B_QUIT_REQUESTED)))
.End();
fExceptionThrown->SetTarget(this);
fExceptionCaught->SetTarget(this);
// TODO: enable once implemented
fExceptionCaught->SetEnabled(false);
fCloseButton->SetTarget(this);
}
void
ExceptionConfigWindow::Show()
{
CenterOnScreen();
BWindow::Show();
}
void
ExceptionConfigWindow::MessageReceived(BMessage* message)
{
switch (message->what) {
case MSG_STOP_ON_THROWN_EXCEPTION_CHANGED:
{
break;
}
case MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED:
{
break;
}
default:
BWindow::MessageReceived(message);
break;
}
}

View File

@ -0,0 +1,50 @@
/*
* Copyright 2013, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef EXCEPTION_CONFIG_WINDOW_H
#define EXCEPTION_CONFIG_WINDOW_H
#include <Window.h>
class BButton;
class BCheckBox;
class Team;
class UserInterfaceListener;
class ExceptionConfigWindow : public BWindow
{
public:
ExceptionConfigWindow(::Team* team,
UserInterfaceListener* listener,
BHandler* target);
~ExceptionConfigWindow();
static ExceptionConfigWindow* Create(::Team* team,
UserInterfaceListener* listener,
BHandler* target);
// throws
virtual void MessageReceived(BMessage* message);
virtual void Show();
private:
void _Init();
private:
::Team* fTeam;
UserInterfaceListener* fListener;
BCheckBox* fExceptionThrown;
BCheckBox* fExceptionCaught;
BButton* fCloseButton;
BHandler* fTarget;
};
#endif // EXCEPTION_CONFIG_WINDOW_H