Derived from: public BTextView
Declared in: PasswordView.h
The PasswordView class augments the BTextView InsertText() and DeleteText() to replace typed charaters with a blot character so that the password cannot be read. This implementation allows dragged text and pastes. Copy and Cut commands will only retrieve the blot charaters selected. Likewise a selected text that is dragged outside the PasswordView is only show the blot characters. Dragging text within the PasswordView functions as usual. The only way programatically to get the password is to call the Password() function which functions similarly to BTextView::Text().
The PasswordView supports the standard Scripting suites supported by BTextView, however requests for the text return only the blot characters.
PasswordView( BRect frame, const char *name, BRect textRect, uint32 resizingMode, uint32 flags) PasswordView( BRect frame, const char *name, BRect textRect, const BFont *font, const rgb_color *color, uint32 resizingMode, uint32 flags) PasswordView(BMessage *archive)
These function simply pass their arguments on to the matching BTextView constructor.
virtual ~PasswordView()
Deletes the internal password buffer and wipes the memory.
const char* Password() const
Returns a pointer to the password string. This function fuctions similarly to BTextView::Text() and has the same caveats.
See also: BTextView::Text()
virtual void SetBlotChar( const char *blotChar) const char* GetBlotChar() const
SetBlotChar() sets the blot character. This is the character that will replace all that are entered in the view. This must be a single chararter, multi-byte UTF-8 characters are allowed. Note: In the current version having UTF-8 blot characters can occasionally be flaky. It will work fine in most cases, except under heavy editing.
GetBlotChar() returns the current blot character.
virtual void InsertText(const char *inText, int32 inLength, int32 inOffset, const text_run_array *inRuns) virtual void DeleteText(int32 fromOffset, int32 toOffset)
Augments InsertText() and DeleteText() to replace typed charaters with a blot character so that the password cannot be read. The actual text typed by the user is stored as clear text in a private buffer. Keeping the password encrypted in memory wil be implemented is a future verison.
As implementated the PasswordView class allows dragging of text. The BMessage containing the drag information only contains the blot characters, the actual text that is dragged is stored internally and used if the drag is dropped within the view. This mean that only this view can "see" the text of the password. Likewise Copy and Cut commands will only retrieve the blot charaters selected.
Currently InsertText() expect ACSII input, if given a multi-byte character(s) nothing will be inserted.
C_UTF8_BULLET | "\xE2\x80\xA2" | The round bullet character. |
Copyright © 1998 Neil G. Miller, Inc. All rights reserved.
Neil G. Miller < neil.miller@pobox.com>
Last modified: Thu, Apr 23, 1998