LXRAD 0.7
ccontrol.h
Go to the documentation of this file.
1/* ########################################################################
2
3 LXRAD - GUI for X programing
4
5 ########################################################################
6
7 Copyright (c) : 2001 Luis Claudio Gamboa Lopes
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 For e-mail suggestions : lcgamboa@yahoo.com
24 ######################################################################## */
25
32#ifndef CCONTROL
33#define CCONTROL
34
35#include"cobject.h"
36
37class CWindow;
38class CPMenu;
39class CMenu;
40
46class CControl:public CObject
47{
48protected:
51 wxWindow *Widget;
52 long Wid;
53 bool Dynamic;
54 bool CanFocus;
57 bool DragAcceptFiles;
58 bool Enable;
59 int X, Y;
60 uint Width, Height;
61 uint Border;
62 lxString ColorName;
63 unsigned char ColorRGB[3];
64 CControl **Child;
65 int ChildCount;
66 lxString FontName;
67 uint FontSize;
68 CControl *Owner;
69 bool Visible;
70 CPMenu *PopupMenu;
71 CWindow *Win;
72 lxString Hint;
73 unsigned long int BTimePress;
74 unsigned long int BTimeRelease;
75 unsigned long int BTimeClick;
76 virtual int CEvent (int event);
77public:
78 CControl (void);
79 ~CControl (void);
80 virtual void SetName (const lxString name);
81 lxString GetName (void);
82 CWindow *GetWin (void);
83 void SetWin (CWindow * win);
84 virtual wxWindow *GetWidget (void);
85 virtual void Event (wxEvent & event);
86 virtual int Create (CControl * control);
87 virtual void Destroy (void);
88 virtual void Erase (void);
89 virtual void Draw (void);
90 virtual void Update (void);
92 void SetContext (lxStringList context);
93 void SetDragAcceptFiles(bool accept);
94//propiedades
95 void SetFont (const lxString font);
96 lxString GetFontName (void);
97 void SetFontSize (uint size);
98 uint GetFontSize (void);
99 virtual void SetX (int x);
100 virtual int GetX (void);
101 virtual void SetY (int y);
102 virtual int GetY (void);
103 virtual void SetBorder (uint border);
104 uint GetBorder (void);
105 virtual void SetWidth (unsigned w);
106 virtual uint GetWidth (void);
107 virtual void SetHeight (unsigned h);
108 virtual uint GetHeight (void);
109 void SetWid (int wid);
110 long GetWid (void);
111 virtual void SetColorName (const lxString name);
112 virtual void SetColor (unsigned r, unsigned g, unsigned b);
113 virtual void SetColor (wxColor color);
114 wxColor GetColor(void);
115 virtual void SetEnable (bool enable);
116 virtual bool GetEnable (void);
117 void SetOwner (CControl * control);
118 CControl *GetOwner (void);
119 void SetVisible (bool visible, bool update = true);
120 bool GetVisible (void);
121 bool GetCanVisible (void);
122 void SetPopupMenu (CPMenu * popupmenu);
123 void SetFocus (void);
124 bool GetFocus (void);
125 void SetCanFocus (bool canfocus);
126 bool GetCanFocus (void);
127 bool GetDynamic (void);
128 int GetChildCount (void);
129 void SetHint (lxString hint);
130 lxString GetHint (void);
131 CControl *GetChild (uint child);
132 virtual CControl *GetChildByWidget (wxWindow * widget);
133 CControl *GetChildByWid (long wid);
134 CControl *GetChildByName (const lxString child);
135 virtual void CreateChild (CControl * control, bool onlyput = false);
136 virtual void DestroyChild (CControl * control);
137 virtual void DestroyChilds (void);
138 virtual void WriteXMLContext (lxString filename, bool first = true);
139 virtual void LoadXMLContext (lxString filename);
140 void SetCanExecuteEvent (bool can);
141 bool GetCanExecuteEvent (void);
142//operators
143 void *operator new (size_t sz);
144 void operator delete (void *p);
145 void SetFOwner (CControl * control);
146 CControl *GetFOwner (void);
147
148//events
149
150 virtual void mouse_move (wxMouseEvent* event);
151 virtual void button_press (wxMouseEvent* event);
152 virtual void button_release (wxMouseEvent* event);
153 virtual void key_press (wxKeyEvent* event);
154 virtual void key_release (wxKeyEvent *event);
155 virtual void focus_in (wxMouseEvent* event);
156 virtual void focus_out (wxMouseEvent* event);
157 virtual void on_draw (wxPaintEvent* event);
158 virtual void mouse_wheel (wxMouseEvent* event);
159 virtual void on_drop_files(wxDropFilesEvent* event);
160
161 void (CControl::*EvMouseMove) (CControl * control,const uint button,const uint x,const uint y,const uint mask);
162 void (CControl::*EvMouseButtonPress) (CControl * control,const uint button,const uint x,const uint y,const uint mask);
163 void (CControl::*EvMouseButtonRelease) (CControl * control,const uint button,const uint x,const uint y,const uint mask);
164 void (CControl::*EvMouseButtonClick) (CControl * control,const uint button,const uint x,const uint y,const uint mask);
165 void (CControl::*EvMouseButtonDoubleClick) (CControl * control,const uint button,const uint x,const uint y,const uint mask);
166 void (CControl::*EvKeyboardPress) (CControl * control,const uint keyval,const uint hardware_keycode,const uint state);
167 void (CControl::*EvKeyboardRelease) (CControl * control,const uint keyval,const uint hardware_keycode,const uint state);
168 void (CControl::*EvOnDraw) (CControl * control);
169 void (CControl::*EvOnFocusIn) (CControl * control);
170 void (CControl::*EvOnFocusOut) (CControl * control);
171 void (CControl::*EvMouseWheel) (CControl * control, const int rotation);
172 void (CControl::*EvOnDropFile) (CControl * control, const lxString fname);
173
174};
175#endif
Generic Control.
Definition: ccontrol.h:47
CControl * ControlOnFocus
Control On Focus.
Definition: ccontrol.h:50
bool CanFocus
CanFocus ?
Definition: ccontrol.h:54
bool CanVisible
Can be Visible ?
Definition: ccontrol.h:56
bool Dynamic
Dynamic Object?
Definition: ccontrol.h:53
lxStringList GetContext(void)
long Wid
wx ID
Definition: ccontrol.h:52
bool CanExecuteEvent
Can Execute Event ?
Definition: ccontrol.h:55
void SetContext(lxStringList context)
CControl * FOwner
function owner control
Definition: ccontrol.h:49
wxWindow * Widget
Object wxWidget.
Definition: ccontrol.h:51
Image Control.
Definition: cmenu.h:46
Generic Object.
Definition: cobject.h:43
Image Control.
Definition: cpmenu.h:47
Image Control.
Definition: cwindow.h:50