You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
piklab/src/libgui/register_view.cpp

52 lines
1.9 KiB

/***************************************************************************
* Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "register_view.h"
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqpushbutton.h>
#include <tqcheckbox.h>
#include <klocale.h>
#include "devices/base/device_group.h"
#include "devices/gui/device_group_ui.h"
#include "progs/base/prog_group.h"
#include "common/gui/misc_gui.h"
#include "main_global.h"
#include "editor_manager.h"
#include "gui_debug_manager.h"
//-----------------------------------------------------------------------------
Register::MainView::MainView(const TQString &title, const TQString &tag, TQWidget *parent)
: DeviceEditor(title, tag, parent, "register_view"), _debugging(false)
{}
void Register::MainView::setDevice(bool force)
{
bool oldDebugging = _debugging;
_debugging = Main::programmerGroup().isDebugger();
DeviceEditor::setDevice(force || oldDebugging!=_debugging);
}
TQWidget *Register::MainView::createView(const Device::Data *data, TQWidget *parent)
{
if ( data==0 ) return new TQWidget(parent);
Register::View *view = Device::groupui(*data).createRegisterView(parent);
if (view) view->updateView();
else {
TQWidget *w = new TQWidget(parent);
TQVBoxLayout *vbox = new TQVBoxLayout(w, 10, 10);
TQLabel *label = new TQLabel(i18n("The selected device has no register."), w);
vbox->addWidget(label);
vbox->addStretch(1);
return w;
}
return view;
}