DeskCalc: Add private _IsEmbedded() method
This commit is contained in:
@@ -315,12 +315,7 @@ CalcView::MessageReceived(BMessage* message)
|
|||||||
void
|
void
|
||||||
CalcView::Draw(BRect updateRect)
|
CalcView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
bool drawBackground = true;
|
bool drawBackground = !_IsEmbedded();
|
||||||
if (Parent() && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0) {
|
|
||||||
// CalcView is embedded somewhere, most likely the Tracker Desktop
|
|
||||||
// shelf.
|
|
||||||
drawBackground = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SetHighColor(fBaseColor);
|
SetHighColor(fBaseColor);
|
||||||
BRect expressionRect(_ExpressionRect());
|
BRect expressionRect(_ExpressionRect());
|
||||||
@@ -809,13 +804,16 @@ CalcView::SetDegreeMode(bool degrees)
|
|||||||
void
|
void
|
||||||
CalcView::SetKeypadMode(uint8 mode)
|
CalcView::SetKeypadMode(uint8 mode)
|
||||||
{
|
{
|
||||||
if (fOptions->keypad_mode == mode)
|
if (_IsEmbedded())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BWindow* window = Window();
|
BWindow* window = Window();
|
||||||
if (window == NULL)
|
if (window == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (fOptions->keypad_mode == mode)
|
||||||
|
return;
|
||||||
|
|
||||||
fOptions->keypad_mode = mode;
|
fOptions->keypad_mode = mode;
|
||||||
_MarkKeypadItems(fOptions->keypad_mode);
|
_MarkKeypadItems(fOptions->keypad_mode);
|
||||||
|
|
||||||
@@ -1278,3 +1276,12 @@ CalcView::_FetchAppIcon(BBitmap* into)
|
|||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
memset(into->Bits(), 0, into->BitsLength());
|
memset(into->Bits(), 0, into->BitsLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Returns whether or not CalcView is embedded somewhere, most likely
|
||||||
|
// the Desktop
|
||||||
|
bool
|
||||||
|
CalcView::_IsEmbedded()
|
||||||
|
{
|
||||||
|
return Parent() != NULL && (Parent()->Flags() & B_DRAW_ON_CHILDREN) != 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ class CalcView : public BView {
|
|||||||
void _MarkKeypadItems(uint8 mode);
|
void _MarkKeypadItems(uint8 mode);
|
||||||
|
|
||||||
void _FetchAppIcon(BBitmap* into);
|
void _FetchAppIcon(BBitmap* into);
|
||||||
|
bool _IsEmbedded();
|
||||||
|
|
||||||
// grid dimensions
|
// grid dimensions
|
||||||
int16 fColumns;
|
int16 fColumns;
|
||||||
|
|||||||
Reference in New Issue
Block a user