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

FXColorWell.h
1 /********************************************************************************
2 * *
3 * C o l o r W e l l W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2022 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXCOLORWELL_H
22 #define FXCOLORWELL_H
23 
24 #ifndef FXFRAME_H
25 #include "FXFrame.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 // Color Well Styles
32 enum {
33  COLORWELL_OPAQUEONLY = 0x00008000,
34  COLORWELL_SOURCEONLY = 0x00010000,
35  COLORWELL_NORMAL = FRAME_SUNKEN|FRAME_THICK
36  };
37 
38 
39 
51 class FXAPI FXColorWell : public FXFrame {
52  FXDECLARE(FXColorWell)
53 protected:
54  FXColor wellColor[2]; // Pixel value of RGBA over black and white
55  FXint wellSize; // Well size
56  FXColor rgba; // Color with RGB and Alpha
57  FXString tip; // Tooltip value
58  FXString help; // Help value
59 protected:
60  FXColorWell();
61 private:
62  FXColorWell(const FXColorWell&);
63  FXColorWell &operator=(const FXColorWell&);
64 public:
65  long onPaint(FXObject*,FXSelector,void*);
66  long onLeftBtnPress(FXObject*,FXSelector,void*);
67  long onLeftBtnRelease(FXObject*,FXSelector,void*);
68  long onKeyPress(FXObject*,FXSelector,void*);
69  long onKeyRelease(FXObject*,FXSelector,void*);
70  long onUngrabbed(FXObject*,FXSelector,void*);
71  long onMotion(FXObject*,FXSelector,void*);
72  long onBeginDrag(FXObject*,FXSelector,void*);
73  long onEndDrag(FXObject*,FXSelector,void*);
74  long onDragged(FXObject*,FXSelector,void*);
75  long onFocusIn(FXObject*,FXSelector,void*);
76  long onFocusOut(FXObject*,FXSelector,void*);
77  long onDNDEnter(FXObject*,FXSelector,void*);
78  long onDNDLeave(FXObject*,FXSelector,void*);
79  long onDNDMotion(FXObject*,FXSelector,void*);
80  long onDNDDrop(FXObject*,FXSelector,void*);
81  long onDNDRequest(FXObject*,FXSelector,void*);
82  long onClicked(FXObject*,FXSelector,void*);
83  long onDoubleClicked(FXObject*,FXSelector,void*);
84  long onCmdSetValue(FXObject*,FXSelector,void*);
85  long onCmdSetIntValue(FXObject*,FXSelector,void*);
86  long onCmdGetIntValue(FXObject*,FXSelector,void*);
87  long onCmdSetHelp(FXObject*,FXSelector,void*);
88  long onCmdGetHelp(FXObject*,FXSelector,void*);
89  long onCmdSetTip(FXObject*,FXSelector,void*);
90  long onCmdGetTip(FXObject*,FXSelector,void*);
91  long onQueryHelp(FXObject*,FXSelector,void*);
92  long onQueryTip(FXObject*,FXSelector,void*);
93  long onUpdColor(FXObject*,FXSelector,void*);
94  long onChgColor(FXObject*,FXSelector,void*);
95  long onCmdColor(FXObject*,FXSelector,void*);
96 public:
97  enum {
98  ID_COLOR=FXFrame::ID_LAST,
99  ID_LAST
100  };
101 public:
102 
104  FXColorWell(FXComposite* p,FXColor clr=0,FXObject* tgt=nullptr,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);
105 
107  virtual FXint getDefaultWidth();
108 
110  virtual FXint getDefaultHeight();
111 
113  virtual FXbool canFocus() const;
114 
116  virtual void setFocus();
117 
119  virtual void killFocus();
120 
122  void setRGBA(FXColor clr,FXbool notify=false);
123 
125  FXColor getRGBA() const { return rgba; }
126 
128  void setHelpText(const FXString& text){ help=text; }
129 
131  const FXString& getHelpText() const { return help; }
132 
134  void setTipText(const FXString& text){ tip=text; }
135 
137  const FXString& getTipText() const { return tip; }
138 
140  void setWellSise(FXint ws);
141 
143  FXint getWellSize() const { return wellSize; }
144 
146  FXbool isOpaqueOnly() const;
147 
149  void setOpaqueOnly(FXbool opaque);
150 
152  FXbool isSourceOnly() const;
153 
155  void setSourceOnly(FXbool srconly);
156 
158  virtual void save(FXStream& store) const;
159 
161  virtual void load(FXStream& store);
162 
164  virtual ~FXColorWell();
165  };
166 
167 }
168 
169 #endif
void setHelpText(const FXString &text)
Set status line help text for this color well.
Definition: FXColorWell.h:128
The Frame widget provides borders around some contents.
Definition: FXFrame.h:58
void setTipText(const FXString &text)
Set tool tip message for this color well.
Definition: FXColorWell.h:134
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
A color well is a widget which controls color settings.
Definition: FXColorWell.h:51
Definition: FX4Splitter.h:28
const FXString & getHelpText() const
Get status line help text for this color well.
Definition: FXColorWell.h:131
const FXString & getTipText() const
Get tool tip message for this color well.
Definition: FXColorWell.h:137
FXColor getRGBA() const
Get color.
Definition: FXColorWell.h:125
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
FXint getWellSize() const
Return well size.
Definition: FXColorWell.h:143
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp