summaryrefslogtreecommitdiffstats
path: root/src/devices/pic/gui/pic_register_view.h
blob: 11882c07967b52244aa383f9460a47821d26344d (plain)
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
/***************************************************************************
 *   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.                                   *
 ***************************************************************************/
#ifndef PIC_REGISTER_VIEW_H
#define PIC_REGISTER_VIEW_H

#include <tqvaluevector.h>
class TQPushButton;
class TQCheckBox;
class TQLabel;
class TQComboBox;

#include "devices/gui/register_view.h"
#include "devices/pic/base/pic.h"
#include "devices/pic/base/pic_register.h"
class PopupButton;
namespace Device { class RegisterHexWordEditor; }

namespace Pic
{
//-----------------------------------------------------------------------------
class BankWidget : public TQFrame
{
Q_OBJECT
  
public:
  BankWidget(uint bank, TQWidget *parent);
  void updateView();

private slots:
  void buttonActivated(int id);
  void write();
  void bankChanged();

private:
  enum Id { ReadId, EditId, WatchId };
  class Data {
  public:
    Data() : label(0), button(0), edit(0) {}
    uint address;
    TQLabel *alabel, *label;
    PopupButton *button;
    Register::LineEdit *edit;
  };
  uint _bindex;
  TQComboBox *_bankCombo;
  TQValueVector<Data> _registers;

  uint bank() const;
  uint nbRegisters() const;
  uint indexOffset() const;
  void updateRegisterAddresses();
};

//-----------------------------------------------------------------------------
class RegisterView : public Register::View
{
Q_OBJECT
  
public:
  RegisterView(TQWidget *parent);
  virtual void updateView();

private slots:
  void stopWatchAllRegisters();

private:
  TQPushButton *_readAllButton, *_clearAllButton;
  TQValueVector<BankWidget *> _banks;
};

//-----------------------------------------------------------------------------
class RegisterListViewItem : public Register::ListViewItem
{
public:
  RegisterListViewItem(const Register::TypeData &data, TDEListViewItem *parent);

private:
  virtual uint nbCharsAddress() const;
  virtual TQString label() const;
};

} // namespace

#endif