summaryrefslogtreecommitdiffstats
path: root/kcoloredit/kcoloreditview.h
blob: 18709764f906595e7ff2b93a4b4adce3f1aeface (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/***************************************************************************
                          kcoloreditview.h  -  description
                             -------------------
    begin                : Sat Jul  8 09:57:28 CEST 2000
    copyright            : (C) 2000 by Artur Rataj
    email                : art@zeus.polsl.gliwice.pl
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 KCOLOREDITVIEW_H
#define KCOLOREDITVIEW_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif 

// include files for TQt
#include <tqsplitter.h>
#include <tqcheckbox.h>
#include <tqlabel.h>

// application specific includes
#include "colorselector.h"
#include "paletteview.h"

class KColorEditDoc;

/** The KColorEditView class provides the view widget for the KColorEditApp instance.	
 * The View instance inherits TQWidget as a base class and represents the view object of a KMainWindow. As KColorEditView is part of the
 * docuement-view model, it needs a reference to the document object connected with it by the KColorEditApp class to manipulate and display
 * the document structure provided by the KColorEditDoc class.
 * 	
 * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
 * @version KDevelop version 0.4 code generation
 */
class KColorEditView : public TQSplitter {
  Q_OBJECT
  

  public:
    /** Constructor for the main view */
    KColorEditView(TQWidget *parent = 0, const char *name = 0);
    /** Destructor for the main view */
    ~KColorEditView();

    /** returns a pointer to the document connected to the view instance. Mind that this method requires a KColorEditApp instance as a parent
     * widget to get to the window document pointer by calling the KColorEditApp::getDocument() method.
     *
     * @see KColorEditApp#getDocument
     */
    KColorEditDoc *document() const;

    /** Contains the implementation for printing functionality */
    void print(TQPrinter *pPrinter);
		/** Chooses a color to the color selector */
		void chooseColor(Color* const color);
		/** Updates the view after the document has been changed */
		void redraw(bool newDocument);
		
	public slots:
		/** Notifies that the cursor position changed */
		void slotCursorPosChanged(int position);
		/** Whether to view color names */
		void slotViewColorNames(bool viewColorNames);
  	
	protected:
		ColorSelector* colorSelector;
		PaletteView* paletteView;
		
	protected slots:
		/** Adds a color from color selector at cursor position. It inserts or replaces a color,
		 *  depending on addColorMode
		 */
		void slotAddColor();
		/** Sets if add a color at cursor */
		void slotAddColorAtCursor(bool atCursor);
		/** Sets whether insert or replace a color */
		void slotAddColorOverwrite(bool overwrite);
		/** Sets a color name */
		void slotSetColorName(const TQString& name);
		
	protected:
		/** Add color mode constants */
		enum { INSERT_COLOR = 0,
		       REPLACE_COLOR = 1 };
		
		/** Color mode widget */
		TQCheckBox* overwriteCheckBox;
		/** Color name widget */
		TQLineEdit* colorName;
		/** H component value label of the color at cursor */
		TQLabel* colorAtCursorHValueLabel;
		/** S component value label of the color at cursor */
		TQLabel* colorAtCursorSValueLabel;
		/** V component value label of the color at cursor */
		TQLabel* colorAtCursorVValueLabel;
		/** R component value label of the color at cursor */
		TQLabel* colorAtCursorRValueLabel;
		/** G component value label of the color at cursor */
		TQLabel* colorAtCursorGValueLabel;
		/** B component value label of the color at cursor */
		TQLabel* colorAtCursorBValueLabel;
		/** RGB Hex string value label of the color at cursor */
		TQLabel* colorAtCursorRgbStringValueLabel;
		/** If add a color at cursor */
		bool addColorAtCursor;
		/** Add color mode */
		int addColorMode;
		/** If in color name changing */
		bool inColorNameChanging;
		/** Whether not to update color labels */
		bool doNotUpdateColorLabels;
		
	protected:
		/** Sets component value label of the color at cursor sizes */
		void setColorAtCursorComponentValueLabelSizes(TQLabel* const label);
		/** Updates color value labels */
		void updateColorValueLabels();
};

#endif // KCOLOREDITVIEW_H