2 * Copyright 2006, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Stephan Aßmus <superstippi@gmx.de>
9 #include "AssignStyleCommand.h"
18 #undef B_TRANSLATION_CONTEXT
19 #define B_TRANSLATION_CONTEXT "Icon-O-Matic-AssignStyleCmd"
23 AssignStyleCommand::AssignStyleCommand(Shape
* shape
,
27 fOldStyle(shape
? shape
->Style() : NULL
),
31 fOldStyle
->AcquireReference();
33 fNewStyle
->AcquireReference();
37 AssignStyleCommand::~AssignStyleCommand()
40 fOldStyle
->ReleaseReference();
42 fNewStyle
->ReleaseReference();
47 AssignStyleCommand::InitCheck()
49 return fShape
&& fNewStyle
? B_OK
: B_NO_INIT
;
54 AssignStyleCommand::Perform()
56 fShape
->SetStyle(fNewStyle
);
63 AssignStyleCommand::Undo()
65 fShape
->SetStyle(fOldStyle
);
72 AssignStyleCommand::GetName(BString
& name
)
74 name
<< B_TRANSLATE("Assign Style");
76 name
<< " \"" << fNewStyle
->Name() << "\"";