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