summaryrefslogtreecommitdiff
path: root/xml
diff options
context:
space:
mode:
Diffstat (limited to 'xml')
-rw-r--r--xml/display.h2
-rw-r--r--xml/object.c23
-rw-r--r--xml/object.h10
3 files changed, 21 insertions, 14 deletions
diff --git a/xml/display.h b/xml/display.h
index 319cc7e..a9b2080 100644
--- a/xml/display.h
+++ b/xml/display.h
@@ -48,7 +48,7 @@ public:
cxSkin *Skin(void) const { return mSkin; }
uint Objects(void) const { return mObjects.size(); }
- const cxObject *GetObject(int n) const { return mObjects[n]; }
+ cxObject *GetObject(int n) const { return mObjects[n]; }
};
class cxDisplays: public std::map<cxDisplay::eType,cxDisplay*> {
diff --git a/xml/object.c b/xml/object.c
index c63c2ea..81dc854 100644
--- a/xml/object.c
+++ b/xml/object.c
@@ -155,18 +155,25 @@ const cFont *cxObject::Font(void) const
return cFont::GetFont(fontOsd);
}
-txPoint cxObject::Pos(void) const
+txPoint cxObject::Pos(const txPoint &BaseOffset, const txSize &BaseSize) const
{
- return txPoint(mSkin->BaseOffset().x + (mPos1.x < 0 ? Skin()->BaseSize().w + mPos1.x : mPos1.x),
- mSkin->BaseOffset().y + (mPos1.y < 0 ? Skin()->BaseSize().h + mPos1.y : mPos1.y));
+ txPoint bOffset = BaseOffset.x < 0 ? mSkin->BaseOffset() : BaseOffset;
+ txSize bSize = BaseSize.w < 0 ? mSkin->BaseSize() : BaseSize;
+
+ return txPoint(bOffset.x + (mPos1.x < 0 ? bSize.w + mPos1.x : mPos1.x),
+ bOffset.y + (mPos1.y < 0 ? bSize.h + mPos1.y : mPos1.y));
}
-txSize cxObject::Size(void) const
+txSize cxObject::Size(const txPoint &BaseOffset, const txSize &BaseSize) const
{
- txPoint p1(mSkin->BaseOffset().x + (mPos1.x < 0 ? Skin()->BaseSize().w + mPos1.x : mPos1.x),
- mSkin->BaseOffset().y + (mPos1.y < 0 ? Skin()->BaseSize().h + mPos1.y : mPos1.y));
- txPoint p2(mSkin->BaseOffset().x + (mPos2.x < 0 ? Skin()->BaseSize().w + mPos2.x : mPos2.x),
- mSkin->BaseOffset().y + (mPos2.y < 0 ? Skin()->BaseSize().h + mPos2.y : mPos2.y));
+ txPoint bOffset = BaseOffset.x < 0 ? mSkin->BaseOffset() : BaseOffset;
+ txSize bSize = BaseSize.w < 0 ? mSkin->BaseSize() : BaseSize;
+
+ txPoint p1(bOffset.x + (mPos1.x < 0 ? bSize.w + mPos1.x : mPos1.x),
+ bOffset.y + (mPos1.y < 0 ? bSize.h + mPos1.y : mPos1.y));
+ txPoint p2(bOffset.x + (mPos2.x < 0 ? bSize.w + mPos2.x : mPos2.x),
+ bOffset.y + (mPos2.y < 0 ? bSize.h + mPos2.y : mPos2.y));
+
return txSize(p2.x - p1.x + 1, p2.y - p1.y + 1);
}
diff --git a/xml/object.h b/xml/object.h
index bbc37a0..603019f 100644
--- a/xml/object.h
+++ b/xml/object.h
@@ -61,7 +61,7 @@ public:
item,
#define __COUNT_OBJECT__ (item + 1)
};
-
+
private:
cxDisplay *mDisplay;
cxSkin *mSkin;
@@ -118,8 +118,8 @@ public:
cxSkin *Skin(void) const { return mSkin; }
const std::string &TypeName(void) const;
- txPoint Pos(void) const;
- txSize Size(void) const;
+ txPoint Pos(const txPoint &BaseOffset=txPoint(-1,-1), const txSize &BaseSize=txSize(-1,-1)) const;
+ txSize Size(const txPoint &BaseOffset=txPoint(-1,-1), const txSize &BaseSize=txSize(-1,-1)) const;
const cFont *Font(void) const;
const tColor *Fg(void) const;
const tColor *Bg(void) const;
@@ -129,7 +129,7 @@ public:
const tColor *Keep(void) const;
uint Objects(void) const;
- const cxObject *GetObject(uint Index) const;
+ cxObject *GetObject(uint Index) const;
};
class cxObjects: public std::vector<cxObject*> {
@@ -144,7 +144,7 @@ inline uint cxObject::Objects(void) const
return mObjects ? mObjects->size() : 0;
}
-inline const cxObject *cxObject::GetObject(uint Index) const
+inline cxObject *cxObject::GetObject(uint Index) const
{
return mObjects ? (*mObjects)[Index] : NULL;
}