FXColorWell.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                         C o l o r W e l l   W i d g e t                       *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1998,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (at your option) any later version.            *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXColorWell.h,v 1.35 2006/01/22 17:57:59 fox Exp $                       *
00023 ********************************************************************************/
00024 #ifndef FXCOLORWELL_H
00025 #define FXCOLORWELL_H
00026 
00027 #ifndef FXFRAME_H
00028 #include "FXFrame.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 // Color Well Styles
00035 enum {
00036   COLORWELL_OPAQUEONLY = 0x00008000,  
00037   COLORWELL_SOURCEONLY = 0x00010000,  
00038   COLORWELL_NORMAL     = JUSTIFY_NORMAL
00039   };
00040 
00041 
00042 
00055 class FXAPI FXColorWell : public FXFrame {
00056   FXDECLARE(FXColorWell)
00057 protected:
00058   FXColor   wellColor[2];             // Pixel value of RGBA over black and white
00059   FXColor   rgba;                     // Color with RGB and Alpha
00060   FXString  tip;                      // Tooltip value
00061   FXString  help;                     // Help value
00062 protected:
00063   FXColorWell();
00064   static FXColor rgbaoverblack(FXColor clr);
00065   static FXColor rgbaoverwhite(FXColor clr);
00066 private:
00067   FXColorWell(const FXColorWell&);
00068   FXColorWell &operator=(const FXColorWell&);
00069 public:
00070   long onPaint(FXObject*,FXSelector,void*);
00071   long onLeftBtnPress(FXObject*,FXSelector,void*);
00072   long onLeftBtnRelease(FXObject*,FXSelector,void*);
00073   long onMiddleBtnPress(FXObject*,FXSelector,void*);
00074   long onMiddleBtnRelease(FXObject*,FXSelector,void*);
00075   long onKeyPress(FXObject*,FXSelector,void*);
00076   long onKeyRelease(FXObject*,FXSelector,void*);
00077   long onUngrabbed(FXObject*,FXSelector,void*);
00078   long onMotion(FXObject*,FXSelector,void*);
00079   long onBeginDrag(FXObject*,FXSelector,void*);
00080   long onEndDrag(FXObject*,FXSelector,void*);
00081   long onDragged(FXObject*,FXSelector,void*);
00082   long onFocusIn(FXObject*,FXSelector,void*);
00083   long onFocusOut(FXObject*,FXSelector,void*);
00084   long onDNDEnter(FXObject*,FXSelector,void*);
00085   long onDNDLeave(FXObject*,FXSelector,void*);
00086   long onDNDMotion(FXObject*,FXSelector,void*);
00087   long onDNDDrop(FXObject*,FXSelector,void*);
00088   long onDNDRequest(FXObject*,FXSelector,void*);
00089   long onSelectionLost(FXObject*,FXSelector,void*);
00090   long onSelectionGained(FXObject*,FXSelector,void*);
00091   long onSelectionRequest(FXObject*,FXSelector,void*);
00092   long onClicked(FXObject*,FXSelector,void*);
00093   long onDoubleClicked(FXObject*,FXSelector,void*);
00094   long onCmdSetValue(FXObject*,FXSelector,void*);
00095   long onCmdSetIntValue(FXObject*,FXSelector,void*);
00096   long onCmdGetIntValue(FXObject*,FXSelector,void*);
00097   long onCmdColorWell(FXObject*,FXSelector,void*);
00098   long onChgColorWell(FXObject*,FXSelector,void*);
00099   long onCmdSetHelp(FXObject*,FXSelector,void*);
00100   long onCmdGetHelp(FXObject*,FXSelector,void*);
00101   long onCmdSetTip(FXObject*,FXSelector,void*);
00102   long onCmdGetTip(FXObject*,FXSelector,void*);
00103   long onQueryHelp(FXObject*,FXSelector,void*);
00104   long onQueryTip(FXObject*,FXSelector,void*);
00105 public:
00106   enum {
00107     ID_COLORDIALOG=FXFrame::ID_LAST,
00108     ID_LAST
00109     };
00110 public:
00111 
00113   FXColorWell(FXComposite* p,FXColor clr=0,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=COLORWELL_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
00114 
00116   virtual void create();
00117 
00119   virtual void detach();
00120 
00122   virtual FXint getDefaultWidth();
00123 
00125   virtual FXint getDefaultHeight();
00126 
00128   virtual bool canFocus() const;
00129 
00131   virtual void setFocus();
00132 
00134   virtual void killFocus();
00135 
00137   void setRGBA(FXColor clr,FXbool notify=FALSE);
00138 
00140   FXColor getRGBA() const { return rgba; }
00141 
00143   void setHelpText(const FXString& text){ help=text; }
00144 
00146   const FXString& getHelpText() const { return help; }
00147 
00149   void setTipText(const FXString& text){ tip=text; }
00150 
00152   const FXString& getTipText() const { return tip; }
00153 
00155   FXbool isOpaqueOnly() const;
00156 
00158   void setOpaqueOnly(FXbool opaque);
00159 
00161   virtual void save(FXStream& store) const;
00162 
00164   virtual void load(FXStream& store);
00165 
00167   virtual ~FXColorWell();
00168   };
00169 
00170 }
00171 
00172 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:19 2009 for TnFOX by doxygen v1.4.7