_BTextInput_: style cleanup.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2008, Haiku Inc. All rights reserved.
|
* Copyright 2001-2015, Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -29,7 +29,8 @@ namespace BPrivate {
|
|||||||
|
|
||||||
_BTextInput_::_BTextInput_(BRect frame, BRect textRect, uint32 resizeMask,
|
_BTextInput_::_BTextInput_(BRect frame, BRect textRect, uint32 resizeMask,
|
||||||
uint32 flags)
|
uint32 flags)
|
||||||
: BTextView(frame, "_input_", textRect, resizeMask, flags),
|
:
|
||||||
|
BTextView(frame, "_input_", textRect, resizeMask, flags),
|
||||||
fPreviousText(NULL)
|
fPreviousText(NULL)
|
||||||
{
|
{
|
||||||
MakeResizable(true);
|
MakeResizable(true);
|
||||||
@@ -37,7 +38,8 @@ _BTextInput_::_BTextInput_(BRect frame, BRect textRect, uint32 resizeMask,
|
|||||||
|
|
||||||
|
|
||||||
_BTextInput_::_BTextInput_(BMessage* archive)
|
_BTextInput_::_BTextInput_(BMessage* archive)
|
||||||
: BTextView(archive),
|
:
|
||||||
|
BTextView(archive),
|
||||||
fPreviousText(NULL)
|
fPreviousText(NULL)
|
||||||
{
|
{
|
||||||
MakeResizable(true);
|
MakeResizable(true);
|
||||||
@@ -176,10 +178,8 @@ _BTextInput_::AlignTextRect()
|
|||||||
float hInset = 2;
|
float hInset = 2;
|
||||||
float textFontWidth = TextRect().right;
|
float textFontWidth = TextRect().right;
|
||||||
|
|
||||||
if (be_control_look != NULL)
|
if (be_control_look != NULL) {
|
||||||
{
|
switch (Alignment()) {
|
||||||
switch(Alignment())
|
|
||||||
{
|
|
||||||
case B_ALIGN_LEFT:
|
case B_ALIGN_LEFT:
|
||||||
hInset = be_control_look->DefaultLabelSpacing();
|
hInset = be_control_look->DefaultLabelSpacing();
|
||||||
break;
|
break;
|
||||||
@@ -190,7 +190,7 @@ _BTextInput_::AlignTextRect()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case B_ALIGN_CENTER:
|
case B_ALIGN_CENTER:
|
||||||
hInset = (textRect.right - textFontWidth)/ 2.0;
|
hInset = (textRect.right - textFontWidth) / 2.0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -209,7 +209,7 @@ _BTextInput_::SetInitialText()
|
|||||||
free(fPreviousText);
|
free(fPreviousText);
|
||||||
fPreviousText = NULL;
|
fPreviousText = NULL;
|
||||||
|
|
||||||
if (Text())
|
if (Text() != NULL)
|
||||||
fPreviousText = strdup(Text());
|
fPreviousText = strdup(Text());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,11 +259,10 @@ BTextControl*
|
|||||||
_BTextInput_::TextControl()
|
_BTextInput_::TextControl()
|
||||||
{
|
{
|
||||||
BTextControl* textControl = NULL;
|
BTextControl* textControl = NULL;
|
||||||
|
if (Parent() != NULL)
|
||||||
if (Parent())
|
|
||||||
textControl = dynamic_cast<BTextControl*>(Parent());
|
textControl = dynamic_cast<BTextControl*>(Parent());
|
||||||
|
|
||||||
if (!textControl)
|
if (textControl == NULL)
|
||||||
debugger("_BTextInput_ should have a BTextControl as parent");
|
debugger("_BTextInput_ should have a BTextControl as parent");
|
||||||
|
|
||||||
return textControl;
|
return textControl;
|
||||||
|
|||||||
Reference in New Issue
Block a user