2 * Copyright (c) 2005-2010, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
6 * DarkWyrm <darkwyrm@gmail.com>
8 #include "InternalEditors.h"
9 #include "ResourceData.h"
12 #include <Messenger.h>
17 DoubleEditor::DoubleEditor(const BRect
&frame
, ResourceData
*data
,
19 : Editor(frame
, data
, owner
)
22 SetTitle(data
->GetName());
24 fView
= new StringEditView(Bounds());
27 fView
->SetID(data
->GetIDString());
28 fView
->SetName(data
->GetName());
29 fView
->SetValue(data
->GetData());
34 DoubleEditor::MessageReceived(BMessage
*msg
)
36 if (msg
->what
== M_UPDATE_RESOURCE
) {
37 // We have to have an ID, so if the squirrely developer didn't give us
38 // one, don't do anything
40 int32 newid
= atol(fView
->GetID());
41 GetData()->SetID(newid
);
44 GetData()->SetName(fView
->GetName());
45 GetData()->SetData(fView
->GetValue(), strlen(fView
->GetValue()));
47 BMessage
updatemsg(M_UPDATE_RESOURCE
);
48 updatemsg
.AddPointer("item", GetData());
49 BMessenger
msgr(GetOwner());
50 msgr
.SendMessage(&updatemsg
);
51 PostMessage(B_QUIT_REQUESTED
);
54 Editor::MessageReceived(msg
);