DisposeWatch: Make private and constify members

This commit is contained in:
Jonas Kulla 2014-08-12 21:12:28 +02:00
parent 194f70c48c
commit d128375d62
5 changed files with 15 additions and 15 deletions

View File

@ -42,15 +42,7 @@ struct DisposeWatch
{
typedef void (C::*NotifyFun)();
/* The object owning the prop (and this helper) */
C *owner;
/* Optional notify method */
const NotifyFun notify;
/* Location of the prop pointer inside the owner */
P *&propLocation;
sigc::connection dispCon;
DisposeWatch(C *owner, P *&propLocation, NotifyFun notify = 0)
DisposeWatch(C &owner, P *&propLocation, NotifyFun notify = 0)
: owner(owner),
notify(notify),
propLocation(propLocation)
@ -74,13 +66,21 @@ struct DisposeWatch
}
private:
/* The object owning the prop (and this helper) */
C &owner;
/* Optional notify method */
const NotifyFun notify;
/* Location of the prop pointer inside the owner */
P * &propLocation;
sigc::connection dispCon;
void onDisposed()
{
dispCon.disconnect();
propLocation = 0;
if (notify)
(owner->*notify)();
(owner.*notify)();
}
};

View File

@ -67,7 +67,7 @@ struct PlanePrivate
PlanePrivate()
: bitmap(0),
bitmapWatch(this, bitmap),
bitmapWatch(*this, bitmap),
opacity(255),
blendType(BlendNormal),
color(&tmp.color),

View File

@ -89,7 +89,7 @@ struct SpritePrivate
SpritePrivate()
: bitmap(0),
bitmapWatch(this, bitmap),
bitmapWatch(*this, bitmap),
srcRect(&tmp.rect),
mirrored(false),
bushDepth(0),

View File

@ -355,7 +355,7 @@ struct TilemapPrivate
TilemapPrivate(Viewport *viewport)
: viewport(viewport),
tileset(0),
tilesetWatch(this, tileset),
tilesetWatch(*this, tileset),
mapData(0),
flashData(0),
priorities(0),

View File

@ -250,9 +250,9 @@ struct WindowPrivate
WindowPrivate(Viewport *viewport = 0)
: windowskin(0),
windowskinWatch(this, windowskin),
windowskinWatch(*this, windowskin),
contents(0),
contentsWatch(this, contents, &WindowPrivate::markControlVertDirty),
contentsWatch(*this, contents, &WindowPrivate::markControlVertDirty),
bgStretch(true),
cursorRect(&tmp.rect),
active(true),