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

FXColorList.h
1 /********************************************************************************
2 * *
3 * C o l o r L i s t W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2005,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 FXCOLORLIST_H
22 #define FXCOLORLIST_H
23 
24 #ifndef FXLIST_H
25 #include "FXList.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 class FXAPI FXColorItem : public FXListItem {
33  FXDECLARE(FXColorItem)
34 protected:
35  FXColor color;
36 private:
37  FXColorItem(const FXColorItem&);
38  FXColorItem& operator=(const FXColorItem&);
39 protected:
40  FXColorItem():color(0){}
41  virtual void draw(const FXList* list,FXDC& dc,FXint x,FXint y,FXint w,FXint h) const;
42  virtual FXint hitItem(const FXList* list,FXint x,FXint y) const;
43 public:
45  FXColorItem(const FXString& text,FXColor clr,void* ptr=nullptr):FXListItem(text,nullptr,ptr),color(clr){}
46 
48  void setColor(FXColor clr){ color=clr; }
49 
51  FXColor getColor() const { return color; }
52 
54  virtual FXint getWidth(const FXList* list) const;
55 
57  virtual FXint getHeight(const FXList* list) const;
58  };
59 
60 
64 class FXAPI FXColorList : public FXList {
65  FXDECLARE(FXColorList)
66 protected:
67  FXColorList(){}
68  virtual FXListItem *createItem(const FXString& text,FXIcon* icon,void* ptr);
69 private:
70  FXColorList(const FXColorList&);
71  FXColorList &operator=(const FXColorList&);
72 public:
73 
75  FXColorList(FXComposite *p,FXObject* tgt=nullptr,FXSelector sel=0,FXuint opts=LIST_BROWSESELECT,FXint x=0,FXint y=0,FXint w=0,FXint h=0);
76 
78  FXint fillItems(const FXchar *const *strings,FXColor *colors=nullptr,void* ptr=nullptr,FXbool notify=false);
79 
81  FXint insertItem(FXint index,const FXString& text,FXColor color=0,void* ptr=nullptr,FXbool notify=false);
82 
84  FXint appendItem(const FXString& text,FXColor color=0,void* ptr=nullptr,FXbool notify=false);
85 
87  FXint prependItem(const FXString& text,FXColor color=0,void* ptr=nullptr,FXbool notify=false);
88 
90  void setItemColor(FXint index,FXColor color);
91 
93  FXColor getItemColor(FXint index) const;
94  };
95 
96 }
97 
98 #endif
Color item.
Definition: FXColorList.h:32
FXColor getColor() const
Return item&#39;s color.
Definition: FXColorList.h:51
Base composite.
Definition: FXComposite.h:32
FXColorItem(const FXString &text, FXColor clr, void *ptr=nullptr)
Construct new item with given text, color, and user-data.
Definition: FXColorList.h:45
Abstract Device Context.
Definition: FXDC.h:153
A List Widget displays a list of items, each with a text and optional icon.
Definition: FXList.h:169
Definition: FX4Splitter.h:28
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:42
A ColorList Widget displays a list of colors.
Definition: FXColorList.h:64
void setColor(FXColor clr)
Change item&#39;s color.
Definition: FXColorList.h:48
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:134
List item.
Definition: FXList.h:48
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp