* BTextControl is kept navigable to be handled correctly by BControl::SetEnabled(). MakeFocus() transfers anyway the focus on its textview.

* BControl::SetEnabled() now calls SetFlags(), BTextControl::SetFlags() is then correctly called.
* BControl::SetEnabled() now uses fWantsNav to know if B_NAVIGABLE should be restored


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29028 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2009-01-25 22:18:44 +00:00
parent 74a366707f
commit 73161598d7
2 changed files with 10 additions and 13 deletions

View File

@ -344,10 +344,13 @@ BControl::SetEnabled(bool enabled)
fEnabled = enabled;
if (fEnabled)
BView::SetFlags(Flags() | B_NAVIGABLE);
else
BView::SetFlags(Flags() & ~B_NAVIGABLE);
if (fEnabled && fWantsNav)
SetFlags(Flags() | B_NAVIGABLE);
else if (!fEnabled && (Flags() & B_NAVIGABLE)) {
fWantsNav = true;
SetFlags(Flags() & ~B_NAVIGABLE);
} else
fWantsNav = false;
if (Window()) {
Invalidate(Bounds());
@ -552,7 +555,7 @@ BControl::InitData(BMessage *data)
fEnabled = true;
fFocusChanging = false;
fTracking = false;
fWantsNav = true;
fWantsNav = Flags() & B_NAVIGABLE;
if (data && data->HasString("_fname"))
SetFont(be_plain_font, B_FONT_FAMILY_AND_STYLE);

View File

@ -11,8 +11,6 @@
/*! BTextControl displays text that can act like a control. */
#include <stdio.h>
#include <AbstractLayoutItem.h>
#include <LayoutUtils.h>
#include <Message.h>
@ -27,6 +25,7 @@
//#define TRACE_TEXT_CONTROL
#ifdef TRACE_TEXT_CONTROL
# include <stdio.h>
# include <FunctionTracer.h>
static int32 sFunctionDepth = -1;
# define CALLED(x...) FunctionTracer _ft("BTextControl", __FUNCTION__, \
@ -512,10 +511,7 @@ BTextControl::SetFlags(uint32 flags)
if (flags & B_NAVIGABLE)
fText->SetFlags(fText->Flags() | B_NAVIGABLE);
}
// Don't make this one navigable
flags &= ~B_NAVIGABLE;
BView::SetFlags(flags);
}
@ -929,8 +925,6 @@ BTextControl::_InitData(const char* label, const char* initialText,
fDivider = floorf(bounds.Width() / 2.0f);
uint32 navigableFlags = Flags() & B_NAVIGABLE;
if (navigableFlags != 0)
BView::SetFlags(Flags() & ~B_NAVIGABLE);
if (archive)
fText = static_cast<BPrivate::_BTextInput_*>(FindView("_input_"));