summaryrefslogtreecommitdiffstats
path: root/src/devices/pic/gui/pic_config_word_editor.h
blob: 30068e2a70ffebba6019ee13509a345bd0aa637e (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
/***************************************************************************
 *   Copyright (C) 2005 Nicolas Hadacek <hadacek@kde.org>                  *
 *   Copyright (C) 2003-2004 Alain Gibaud <alain.gibaud@free.fr>           *
 *                                                                         *
 *   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_CONFIG_WORD_EDITOR_H
#define PIC_CONFIG_WORD_EDITOR_H

#include <tqcombobox.h>

#include "common/gui/dialog.h"
#include "common/gui/misc_gui.h"
#include "pic_memory_editor.h"

namespace Pic
{
//----------------------------------------------------------------------------
class ConfigWordDialog : public Dialog
{
Q_OBJECT
  
public:
  ConfigWordDialog(const Memory &memory, uint index, TQWidget *parent);
};

//----------------------------------------------------------------------------
class ConfigWordComboBox : public ComboBox
{
Q_OBJECT
  
public:
  ConfigWordComboBox(TQWidget *parent);
  void appendItem(const TQString &text, uint index) { insertItem(text); _map.append(index); }
  uint index() const;
  void setItem(uint index);
  void setInvalidItem(uint index, const TQString &label);

private:
  TQValueVector<uint> _map; // item index -> value index
  uint _invalidIndex; // if invalid -> value index

  bool isValid() const { return uint(count())==_map.count(); }
};

//----------------------------------------------------------------------------
class ConfigWordEditor : public MemoryEditor
{
Q_OBJECT
  
public:
  ConfigWordEditor(Memory &memory, uint index, bool withWordEditor, TQWidget *parent);
  virtual void setReadOnly(bool readOnly);

public slots:
  virtual void updateDisplay();

private slots:
  void slotModified();
  void showDialog();

private:
  uint _configIndex;
  MemoryRangeEditor *_mdb;
  TQValueVector<ConfigWordComboBox *> _combos;
};

} // namespace

#endif