4
#include <PP_KeyCodes.h>
7
// A text edit field that broadcasts its PaneID on Return or Enter.
10
// ---------------------------------------------------------------------------
11
// � CUrlField Stream Constructor [public]
12
// ---------------------------------------------------------------------------
14
CUrlField::CUrlField(LStream* inStream)
20
// ---------------------------------------------------------------------------
21
// � ~CUrlField Destructor [public]
22
// ---------------------------------------------------------------------------
24
CUrlField::~CUrlField()
29
// ---------------------------------------------------------------------------
31
// ---------------------------------------------------------------------------
32
// Broadcast the paneID when the user hits Return or Enter
35
CUrlField::HandleKeyPress(const EventRecord &inKeyEvent)
37
Boolean keyHandled = true;
38
SInt16 theChar = (SInt16) (inKeyEvent.message & charCodeMask);
40
if (theChar == char_Return || theChar == char_Enter)
43
BroadcastMessage(GetPaneID(), (void*)GetDescriptor(urlString));
46
keyHandled = Inherited::HandleKeyPress(inKeyEvent);
52
// ---------------------------------------------------------------------------
54
// ---------------------------------------------------------------------------
55
// Select everything when a single click gives us the focus
58
CUrlField::ClickSelf(const SMouseDownEvent &inMouseDown)
60
Boolean wasTarget = IsTarget();
62
Inherited::ClickSelf(inMouseDown);
66
ControlEditTextSelectionRec selection;
67
GetSelection(selection);
68
if (selection.selStart == selection.selEnd)