summaryrefslogtreecommitdiffstats
path: root/quanta/messages/messageoutput.h
blob: f958ac004d81552c2675b19d9691c7346e082223 (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
91
/***************************************************************************
                          messageoutput.h  -  description
                             -------------------
    begin                : Thu Feb 24 2000
    copyright            : (C) 2000 by Yacovlev Alexander & Dmitry Poplavski <pdima@mail.univ.kiev.ua>
                           (C) 2002-2005 Andras Mantia <amantia@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 MESSAGEOUTPUT_H
#define MESSAGEOUTPUT_H

#include <tqlistbox.h>

class TDEProcess;
class TDEPopupMenu;

class MessageItem;

/**class for displaing of
weblint output
  *@author Yacovlev Alexander & Dmitry Poplavski
  */

class MessageOutput : public TQListBox  {
   Q_OBJECT
  
public:
  MessageOutput(TQWidget *parent=0, const char *name=0);
  ~MessageOutput();
  // Return whole content as a single string with EOLs
  TQString content();

public slots:
  /**  Inserts an item with the content s to the end of the list*/
  MessageItem *insertItem(const TQString& s);
  
  /** Insert message for each line of string (EOL-separated).
    @param line The line this message refers to. -1 if it's not specified (the first number is taken from the message string)
    @param column The column this message refers to. -1 if it's not specified (the second number is taken from the message string)
    @param fileName The URL of the file this message refers to. If empty, the string following the "File: " string in the message is used.
    @param message The message itself
    @param append Append the message to the previous one or start a new line.  Default is false, start a new line.
  */
  void showMessage(int line, int column, const TQString &fileName, const TQString& message, bool append = false);
  /** Insert message for each line of string (EOL-separated).
    @param message The message itself
    @param append Append the message to the previous one or start a new line. Default is false, start a new line.
  */
  void showMessage(const TQString& message, bool append = false);
  /** Append message string to the last item
    @param line The line this message refers to. -1 if it's not specified (the first number is taken from the message string)
    @param column The column this message refers to. -1 if it's not specified (the second number is taken from the message string)
    @param fileName The URL of the file this message refers to. If empty, the string following the "File: " string in the message is used.
    @param message The message itself
  */
  void addToLastItem(const TQString& message);
  // Copy message content to clipboard
  void copyContent();
  // Save message content to clipboard
  void saveContent();


public:
  uint maxItems() const { return m_maxItems; }
  void setMaxItems( uint items ) {  m_maxItems = items; }
  /** remove first items , if count > m_maxItem  */
  void checkMaxItems();

signals:
  void clicked(const TQString& fname, int line, int col);

protected slots:
  void clickItem( TQListBoxItem *);
  // Show context menu
  void showMenu(TQListBoxItem*, const TQPoint&);

private:
  uint m_maxItems;
  TDEPopupMenu* m_popupMenu;
};

#endif