/***************************************************************************
                          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 TDEMainWindow. 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
