* 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:
@@ -344,10 +344,13 @@ BControl::SetEnabled(bool enabled)
|
|||||||
|
|
||||||
fEnabled = enabled;
|
fEnabled = enabled;
|
||||||
|
|
||||||
if (fEnabled)
|
if (fEnabled && fWantsNav)
|
||||||
BView::SetFlags(Flags() | B_NAVIGABLE);
|
SetFlags(Flags() | B_NAVIGABLE);
|
||||||
else
|
else if (!fEnabled && (Flags() & B_NAVIGABLE)) {
|
||||||
BView::SetFlags(Flags() & ~B_NAVIGABLE);
|
fWantsNav = true;
|
||||||
|
SetFlags(Flags() & ~B_NAVIGABLE);
|
||||||
|
} else
|
||||||
|
fWantsNav = false;
|
||||||
|
|
||||||
if (Window()) {
|
if (Window()) {
|
||||||
Invalidate(Bounds());
|
Invalidate(Bounds());
|
||||||
@@ -552,7 +555,7 @@ BControl::InitData(BMessage *data)
|
|||||||
fEnabled = true;
|
fEnabled = true;
|
||||||
fFocusChanging = false;
|
fFocusChanging = false;
|
||||||
fTracking = false;
|
fTracking = false;
|
||||||
fWantsNav = true;
|
fWantsNav = Flags() & B_NAVIGABLE;
|
||||||
|
|
||||||
if (data && data->HasString("_fname"))
|
if (data && data->HasString("_fname"))
|
||||||
SetFont(be_plain_font, B_FONT_FAMILY_AND_STYLE);
|
SetFont(be_plain_font, B_FONT_FAMILY_AND_STYLE);
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
/*! BTextControl displays text that can act like a control. */
|
/*! BTextControl displays text that can act like a control. */
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <AbstractLayoutItem.h>
|
#include <AbstractLayoutItem.h>
|
||||||
#include <LayoutUtils.h>
|
#include <LayoutUtils.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
@@ -27,6 +25,7 @@
|
|||||||
|
|
||||||
//#define TRACE_TEXT_CONTROL
|
//#define TRACE_TEXT_CONTROL
|
||||||
#ifdef TRACE_TEXT_CONTROL
|
#ifdef TRACE_TEXT_CONTROL
|
||||||
|
# include <stdio.h>
|
||||||
# include <FunctionTracer.h>
|
# include <FunctionTracer.h>
|
||||||
static int32 sFunctionDepth = -1;
|
static int32 sFunctionDepth = -1;
|
||||||
# define CALLED(x...) FunctionTracer _ft("BTextControl", __FUNCTION__, \
|
# define CALLED(x...) FunctionTracer _ft("BTextControl", __FUNCTION__, \
|
||||||
@@ -513,9 +512,6 @@ BTextControl::SetFlags(uint32 flags)
|
|||||||
fText->SetFlags(fText->Flags() | B_NAVIGABLE);
|
fText->SetFlags(fText->Flags() | B_NAVIGABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't make this one navigable
|
|
||||||
flags &= ~B_NAVIGABLE;
|
|
||||||
|
|
||||||
BView::SetFlags(flags);
|
BView::SetFlags(flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -929,8 +925,6 @@ BTextControl::_InitData(const char* label, const char* initialText,
|
|||||||
fDivider = floorf(bounds.Width() / 2.0f);
|
fDivider = floorf(bounds.Width() / 2.0f);
|
||||||
|
|
||||||
uint32 navigableFlags = Flags() & B_NAVIGABLE;
|
uint32 navigableFlags = Flags() & B_NAVIGABLE;
|
||||||
if (navigableFlags != 0)
|
|
||||||
BView::SetFlags(Flags() & ~B_NAVIGABLE);
|
|
||||||
|
|
||||||
if (archive)
|
if (archive)
|
||||||
fText = static_cast<BPrivate::_BTextInput_*>(FindView("_input_"));
|
fText = static_cast<BPrivate::_BTextInput_*>(FindView("_input_"));
|
||||||
|
|||||||
Reference in New Issue
Block a user