Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXColorWell.h

00001 /******************************************************************************** 00002 * * 00003 * C o l o r W e l l W i d g e t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2004 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.30 2004/02/08 17:17:33 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, /// Colors must be opaque 00037 COLORWELL_SOURCEONLY = 0x00010000, /// ColorWell is never a target 00038 COLORWELL_NORMAL = JUSTIFY_NORMAL 00039 }; 00040 00041 00042 00043 /** 00044 * A color well is a widget which controls color settings. 00045 * Colors may be dragged and dropped from one color well to another. 00046 * A double-click inside a color well will bring up the standard 00047 * color dialog panel to edit the color well's color. 00048 * Colors may be also pasted by name using middle-mouse click into/out of 00049 * color wells from/to other selection-capable applications; for example, 00050 * you can highlight the word `red' and paste it into a color well. 00051 * While the color value is being changed, the color well sends a SEL_CHANGED 00052 * to its target; at the end of the change, it sends a SEL_COMMAND. 00053 * The message data represents the current color value, of the type FXColor. 00054 */ 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 onChanged(FXObject*,FXSelector,void*); 00093 long onCommand(FXObject*,FXSelector,void*); 00094 long onClicked(FXObject*,FXSelector,void*); 00095 long onDoubleClicked(FXObject*,FXSelector,void*); 00096 long onTripleClicked(FXObject*,FXSelector,void*); 00097 long onCmdSetValue(FXObject*,FXSelector,void*); 00098 long onCmdSetIntValue(FXObject*,FXSelector,void*); 00099 long onCmdGetIntValue(FXObject*,FXSelector,void*); 00100 long onCmdColorWell(FXObject*,FXSelector,void*); 00101 long onChgColorWell(FXObject*,FXSelector,void*); 00102 long onCmdSetHelp(FXObject*,FXSelector,void*); 00103 long onCmdGetHelp(FXObject*,FXSelector,void*); 00104 long onCmdSetTip(FXObject*,FXSelector,void*); 00105 long onCmdGetTip(FXObject*,FXSelector,void*); 00106 long onQueryHelp(FXObject*,FXSelector,void*); 00107 long onQueryTip(FXObject*,FXSelector,void*); 00108 public: 00109 enum { 00110 ID_COLORDIALOG=FXFrame::ID_LAST, 00111 ID_LAST 00112 }; 00113 public: 00114 00115 /// Construct color well with initial color clr 00116 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); 00117 00118 /// Create server-side resources 00119 virtual void create(); 00120 00121 /// Detach server-side resources 00122 virtual void detach(); 00123 00124 /// Return default width 00125 virtual FXint getDefaultWidth(); 00126 00127 /// Return default height 00128 virtual FXint getDefaultHeight(); 00129 00130 /// Returns true because a color well can receive focus 00131 virtual FXbool canFocus() const; 00132 00133 /// Move the focus to this window 00134 virtual void setFocus(); 00135 00136 /// Remove the focus from this window 00137 virtual void killFocus(); 00138 00139 /// Set color 00140 void setRGBA(FXColor clr); 00141 00142 /// Get color 00143 FXColor getRGBA() const { return rgba; } 00144 00145 /// Set status line help text for this color well 00146 void setHelpText(const FXString& text){ help=text; } 00147 00148 /// Get status line help text for this color well 00149 FXString getHelpText() const { return help; } 00150 00151 /// Set tool tip message for this color well 00152 void setTipText(const FXString& text){ tip=text; } 00153 00154 /// Get tool tip message for this color well 00155 FXString getTipText() const { return tip; } 00156 00157 /// Return true if only opaque colors allowed 00158 FXbool isOpaqueOnly() const; 00159 00160 /// Change opaque only mode 00161 void setOpaqueOnly(FXbool opaque); 00162 00163 /// Save color well to a stream 00164 virtual void save(FXStream& store) const; 00165 00166 /// Load color well from a stream 00167 virtual void load(FXStream& store); 00168 00169 /// Destructor 00170 virtual ~FXColorWell(); 00171 }; 00172 00173 } 00174 00175 #endif

Copyright © 1997-2004 Jeroen van der Zijp