BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / resedit / NumberEditors.cpp
blob5fb79f7e9340492a795e06351ade5d28cc877cec
1 /*
2 * Copyright (c) 2005-2010, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
5 * Author:
6 * DarkWyrm <darkwyrm@gmail.com>
7 */
8 #include "InternalEditors.h"
9 #include "ResourceData.h"
11 #include <Message.h>
12 #include <Messenger.h>
13 #include <String.h>
15 #include <stdlib.h>
17 DoubleEditor::DoubleEditor(const BRect &frame, ResourceData *data,
18 BHandler *owner)
19 : Editor(frame, data, owner)
21 if (data->GetName())
22 SetTitle(data->GetName());
24 fView = new StringEditView(Bounds());
25 AddChild(fView);
27 fView->SetID(data->GetIDString());
28 fView->SetName(data->GetName());
29 fView->SetValue(data->GetData());
33 void
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
39 if (fView->GetID()) {
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);
53 } else {
54 Editor::MessageReceived(msg);