|
| Component (const std::string &aType) |
|
| Component (const std::string &aType, Component &aParent) |
|
virtual | ~Component () |
|
std::string | name () const |
|
void | setName (const std::string &aName) |
|
const std::string & | type () const |
|
HWND | nativeWindow () |
|
Component * | parent () const |
|
virtual void | show () |
|
void | hide () |
|
virtual bool | size (unsigned int &aWidth, unsigned int &aHeight) |
|
virtual bool | position (int &aX, int &aY) |
|
Component * | findFather (const std::string &aType) |
|
bool | setBackground (double aR, double aG, double aB) |
|
void | addCallback (const std::string &aName, Callback aFunction, void *aTag) |
|
void | removeCallback (const std::string &aName, Callback aFunction, void *aTag) |
|
bool | executeCallbacks (const std::string &aName, CallbackData &aData) |
|
bool | hasCallbacks (const std::string &aName) const |
|
|
static void | wm__destroy (HWND aWindow) |
|
static LRESULT CALLBACK | containerProc (HWND aWindow, UINT aMessage, WPARAM aWParam, LPARAM aLParam) |
|
Definition at line 35 of file WinTk.
◆ Component() [1/3]
tools::WinTk::Component::Component |
( |
const std::string & |
aType | ) |
|
|
inline |
Definition at line 42 of file WinTk.
44 tools::mem::increment(s_class().c_str());
◆ Component() [2/3]
tools::WinTk::Component::Component |
( |
const std::string & |
aType, |
|
|
Component & |
aParent |
|
) |
| |
|
inline |
Definition at line 47 of file WinTk.
49 tools::mem::increment(s_class().c_str());
◆ ~Component()
virtual tools::WinTk::Component::~Component |
( |
| ) |
|
|
inlinevirtual |
Definition at line 52 of file WinTk.
54 tools::mem::decrement(s_class().c_str());
◆ Component() [3/3]
tools::WinTk::Component::Component |
( |
Component & |
| ) |
|
|
inlineprotected |
Definition at line 58 of file WinTk.
60 tools::mem::increment(s_class().c_str());
◆ addCallback()
void tools::WinTk::Component::addCallback |
( |
const std::string & |
aName, |
|
|
Callback |
aFunction, |
|
|
void * |
aTag |
|
) |
| |
|
inline |
Definition at line 158 of file WinTk.
159 NamedCallbacks* cbks = 0;
160 std::vector<NamedCallbacks>::iterator it;
162 if(aName==(*it).first) {
168 fCallbacks.push_back(std::pair<std::string,Callbacks>(aName,Callbacks()));
171 cbks->second.push_back(std::pair<Callback,void*>(aFunction,aTag));
◆ containerProc()
static LRESULT CALLBACK tools::WinTk::Component::containerProc |
( |
HWND |
aWindow, |
|
|
UINT |
aMessage, |
|
|
WPARAM |
aWParam, |
|
|
LPARAM |
aLParam |
|
) |
| |
|
inlinestaticprotected |
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Definition at line 249 of file WinTk.
256 case WM_PARENTNOTIFY:{
257 if(aWParam==WM_CREATE) {
260 }
else if(aWParam==WM_DESTROY) {
268 ::GetClientRect(aWindow,&rect);
269 LPARAM
size = MAKELPARAM(rect.right-rect.left,rect.bottom-rect.top);
270 ::SendMessage(aWindow,WM_SIZE,(WPARAM)0,
size);
279 NMHDR* nmhdr = (NMHDR*)aLParam;
280 HWND from_win = nmhdr->hwndFrom;
281 if(from_win!=aWindow) {
282 ::SendMessage(from_win,aMessage,aWParam,aLParam);
288 ::SendMessage((HWND)aLParam,aMessage,aWParam,(LPARAM)0);
◆ destroy()
void tools::WinTk::Component::destroy |
( |
| ) |
|
|
inlineprotected |
Definition at line 297 of file WinTk.
303 ::SetWindowLongPtr(
fWindow,GWLP_USERDATA,LONG_PTR(NULL));
◆ executeCallbacks()
bool tools::WinTk::Component::executeCallbacks |
( |
const std::string & |
aName, |
|
|
CallbackData & |
aData |
|
) |
| |
|
inline |
Definition at line 193 of file WinTk.
194 std::vector<NamedCallbacks>::const_iterator it;
196 if(aName==(*it).first) {
197 const Callbacks& cbks = (*it).second;
198 Callbacks::const_iterator it2;
199 for(it2=cbks.begin();it2!=cbks.end();++it2) {
203 cbk(*
this,aData,(*it2).second);
208 if(back_fWindow && !::GetWindowLongPtr(back_fWindow,GWLP_USERDATA)) {
◆ findFather()
Component* tools::WinTk::Component::findFather |
( |
const std::string & |
aType | ) |
|
|
inline |
Definition at line 100 of file WinTk.
101 if(aType==
type())
return this;
◆ hasCallbacks()
bool tools::WinTk::Component::hasCallbacks |
( |
const std::string & |
aName | ) |
const |
|
inline |
Definition at line 219 of file WinTk.
220 std::vector<NamedCallbacks>::const_iterator it;
222 if(aName==(*it).first)
return true;
◆ hide()
void tools::WinTk::Component::hide |
( |
| ) |
|
|
inline |
Definition at line 75 of file WinTk.
◆ name()
std::string tools::WinTk::Component::name |
( |
| ) |
const |
|
inline |
Definition at line 65 of file WinTk.
◆ nativeWindow()
HWND tools::WinTk::Component::nativeWindow |
( |
| ) |
|
|
inline |
Definition at line 69 of file WinTk.
◆ operator=()
Definition at line 63 of file WinTk.
◆ parent()
Component* tools::WinTk::Component::parent |
( |
| ) |
const |
|
inline |
Definition at line 70 of file WinTk.
◆ position()
virtual bool tools::WinTk::Component::position |
( |
int & |
aX, |
|
|
int & |
aY |
|
) |
| |
|
inlinevirtual |
Definition at line 90 of file WinTk.
◆ removeCallback()
void tools::WinTk::Component::removeCallback |
( |
const std::string & |
aName, |
|
|
Callback |
aFunction, |
|
|
void * |
aTag |
|
) |
| |
|
inline |
Definition at line 173 of file WinTk.
174 NamedCallbacks* cbks = 0;
175 std::vector<NamedCallbacks>::iterator it;
177 if(aName==(*it).first) {
183 Callbacks::iterator it;
184 for(it=cbks->second.begin();it!=cbks->second.end();++it) {
185 if( (aFunction==(*it).first) && (aTag==(*it).second) ) {
186 cbks->second.erase(it);
◆ rubberDrawLine()
void tools::WinTk::Component::rubberDrawLine |
( |
POINT & |
aBegin, |
|
|
POINT & |
aEnd |
|
) |
| |
|
inlineprotected |
Definition at line 308 of file WinTk.
310 HPEN pen = ::CreatePen(PS_SOLID,5,RGB(0,0,0));
311 HDC hdc = ::GetWindowDC(
fWindow);
312 HPEN oldPen = SelectPen(hdc,pen);
313 int oldROP = ::SetROP2(hdc,R2_NOT);
315 ::MoveToEx(hdc,aBegin.x,aBegin.y,&pt);
316 ::LineTo(hdc,aEnd.x,aEnd.y);
317 ::SetROP2(hdc,oldROP);
318 SelectPen(hdc,oldPen);
◆ rubberDrawRect()
void tools::WinTk::Component::rubberDrawRect |
( |
POINT & |
aBegin, |
|
|
POINT & |
aEnd |
|
) |
| |
|
inlineprotected |
Definition at line 322 of file WinTk.
324 HPEN pen = ::CreatePen(PS_SOLID,0,RGB(0,0,0));
325 HDC hdc = ::GetWindowDC(
fWindow);
326 HPEN oldPen = SelectPen(hdc,pen);
327 int oldROP = ::SetROP2(hdc,R2_NOT);
329 ::MoveToEx(hdc,aBegin.x,aBegin.y,&pt);
330 ::LineTo(hdc,aBegin.x,aEnd.y);
331 ::LineTo(hdc,aEnd.x,aEnd.y);
332 ::LineTo(hdc,aEnd.x,aBegin.y);
333 ::LineTo(hdc,aBegin.x,aBegin.y);
334 ::SetROP2(hdc,oldROP);
335 SelectPen(hdc,oldPen);
◆ setBackground()
bool tools::WinTk::Component::setBackground |
( |
double |
aR, |
|
|
double |
aG, |
|
|
double |
aB |
|
) |
| |
|
inline |
Definition at line 110 of file WinTk.
113 int r = int(aR*255.0);
114 if((r<0)||(r>255))
return false;
115 int g = int(aG*255.0);
116 if((g<0)||(g>255))
return false;
117 int b = int(aB*255.0);
118 if((b<0)||(b>255))
return false;
◆ setName()
void tools::WinTk::Component::setName |
( |
const std::string & |
aName | ) |
|
|
inline |
Definition at line 66 of file WinTk.
◆ show()
virtual void tools::WinTk::Component::show |
( |
| ) |
|
|
inlinevirtual |
◆ size()
virtual bool tools::WinTk::Component::size |
( |
unsigned int & |
aWidth, |
|
|
unsigned int & |
aHeight |
|
) |
| |
|
inlinevirtual |
Definition at line 80 of file WinTk.
86 aWidth = rect.right-rect.left;
87 aHeight = rect.bottom-rect.top;
◆ type()
const std::string& tools::WinTk::Component::type |
( |
| ) |
const |
|
inline |
Definition at line 68 of file WinTk.
◆ wm__destroy()
static void tools::WinTk::Component::wm__destroy |
( |
HWND |
aWindow | ) |
|
|
inlinestaticprotected |
Definition at line 227 of file WinTk.
230 if(This->fWindow!=aWindow) {
231 ::printf(
"WinTk::Component::wm_destroy : HWND mismatch !\n");
233 if(This->hasCallbacks(
"WM_DESTROY")) {
235 This->executeCallbacks(
"WM_DESTROY",data);
239 ::SetWindowLongPtr(aWindow,GWLP_USERDATA,LONG_PTR(NULL));
◆ fCallbacks
std::vector<NamedCallbacks> tools::WinTk::Component::fCallbacks |
|
protected |
◆ fName
std::string tools::WinTk::Component::fName |
|
protected |
◆ fParent
◆ fWindow
HWND tools::WinTk::Component::fWindow |
|
protected |
The documentation for this class was generated from the following file:
- /Users/barrand/private/dev/softinex/g4tools/g4tools/tools/Windows/WinTk