diff --git a/src/lib/views/sunlight/include/vContext.h b/src/lib/views/sunlight/include/vContext.h index 2c0fe26..fbb1ab7 100644 --- a/src/lib/views/sunlight/include/vContext.h +++ b/src/lib/views/sunlight/include/vContext.h @@ -25,6 +25,7 @@ virtual void Draw(void); virtual vContext * Detach(vContext *); virtual sStyle * GetStyle(const std::string); + virtual bool IsAttached(void) { return attached; } virtual void SetPos(int32, int32); virtual void SetSize(uInt32, uInt32); virtual void SetStyle(const std::string, sStyle *); diff --git a/src/lib/views/sunlight/vContext.cpp b/src/lib/views/sunlight/vContext.cpp index e041dda..b5770ef 100644 --- a/src/lib/views/sunlight/vContext.cpp +++ b/src/lib/views/sunlight/vContext.cpp @@ -3,6 +3,7 @@ #include #include #include +#include vContext::vContext(vContext * parent) { pContext = parent; @@ -14,6 +15,12 @@ vContext * vContext::Attach(vContext * context) { + /* + * vContext::Attach() + * Accepts a vContext as a parameter and attaches it to the + * current child context list. + * Returns the child context pointer + */ cContexts.push_back(context); return context; } // vContext::Attach @@ -29,7 +36,7 @@ sStyle * tmpStyle = styles[styleKey]; styles.erase(styleKey); delete tmpStyle; - return (NULL == tmpStyle) ? false : true; + return (NULL != tmpStyle); } // vContext::DeleteStyle vContext * @@ -67,9 +74,11 @@ */ // I really should detach from the parent here + if (pContext != NULL) pContext->Detach(this); curX = newX; curY = newY; // and reattach to parent here + if (pContext != NULL) pContext->Attach(this); return; } // vContext::SetPos @@ -93,6 +102,6 @@ vContext::~vContext(void) { delete realView; pContext = NULL; - curX = curY = 0; + curX = curY = width = height = 0; return; } // vContext::~vContext