-
Notifications
You must be signed in to change notification settings - Fork 0
/
CEditItem.cp
executable file
·76 lines (60 loc) · 1.31 KB
/
CEditItem.cp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// ===========================================================================
// CEditItem.cp ©1997-1998 Metrowerks Inc. All rights reserved.
// ===========================================================================
// Original Author: John C. Daub
#include "CEditItem.h"
#include <LInPlaceEditField.h>
CEditItem::CEditItem()
{
LString::CopyPStr( "\pfoo", mText );
}
CEditItem::~CEditItem()
{
// nothing
}
void
CEditItem::GetDrawContentsSelf(
const STableCell& inCell,
SOutlineDrawContents& ioDrawContents)
{
switch (inCell.col)
{
case 1:
{
ioDrawContents.outShowSelection = true;
ioDrawContents.outTextTraits.style = 0;
ioDrawContents.outCanDoInPlaceEdit = true;
LString::CopyPStr( mText, ioDrawContents.outTextString);
break;
}
}
}
void
CEditItem::StartInPlaceEdit(
const STableCell& inCell)
{
LEditableOutlineItem::StartInPlaceEdit( inCell );
// we need to listen for the edit field to stop editing
mEditField = GetEditField();
ThrowIfNil_(mEditField);
mEditField->AddListener(this);
mEditField->SetValueMessage(100);
}
void
CEditItem::ListenToMessage(
MessageT inMessage,
void *ioParam )
{
#pragma unused(ioParam)
switch ( inMessage )
{
case 100:
{
mEditField->GetDescriptor( mText );
if ( mText[0] == 0 ) {
mText = "\p-";
}
break;
}
}
}