BToolBar: made FindButton() public.
This commit is contained in:
@@ -39,12 +39,13 @@ public:
|
|||||||
void SetActionPressed(uint32 command, bool pressed);
|
void SetActionPressed(uint32 command, bool pressed);
|
||||||
void SetActionVisible(uint32 command, bool visible);
|
void SetActionVisible(uint32 command, bool visible);
|
||||||
|
|
||||||
|
BButton* FindButton(uint32 command) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void Pulse();
|
virtual void Pulse();
|
||||||
virtual void FrameResized(float width, float height);
|
virtual void FrameResized(float width, float height);
|
||||||
|
|
||||||
void _Init();
|
void _Init();
|
||||||
BButton* _FindButton(uint32 command) const;
|
|
||||||
void _HideToolTips() const;
|
void _HideToolTips() const;
|
||||||
|
|
||||||
orientation fOrientation;
|
orientation fOrientation;
|
||||||
|
|||||||
+23
-23
@@ -136,7 +136,7 @@ BToolBar::AddView(BView* view)
|
|||||||
void
|
void
|
||||||
BToolBar::SetActionEnabled(uint32 command, bool enabled)
|
BToolBar::SetActionEnabled(uint32 command, bool enabled)
|
||||||
{
|
{
|
||||||
if (BButton* button = _FindButton(command))
|
if (BButton* button = FindButton(command))
|
||||||
button->SetEnabled(enabled);
|
button->SetEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ BToolBar::SetActionEnabled(uint32 command, bool enabled)
|
|||||||
void
|
void
|
||||||
BToolBar::SetActionPressed(uint32 command, bool pressed)
|
BToolBar::SetActionPressed(uint32 command, bool pressed)
|
||||||
{
|
{
|
||||||
if (BButton* button = _FindButton(command))
|
if (BButton* button = FindButton(command))
|
||||||
button->SetValue(pressed);
|
button->SetValue(pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ BToolBar::SetActionPressed(uint32 command, bool pressed)
|
|||||||
void
|
void
|
||||||
BToolBar::SetActionVisible(uint32 command, bool visible)
|
BToolBar::SetActionVisible(uint32 command, bool visible)
|
||||||
{
|
{
|
||||||
BButton* button = _FindButton(command);
|
BButton* button = FindButton(command);
|
||||||
if (button == NULL)
|
if (button == NULL)
|
||||||
return;
|
return;
|
||||||
for (int32 i = 0; BLayoutItem* item = GroupLayout()->ItemAt(i); i++) {
|
for (int32 i = 0; BLayoutItem* item = GroupLayout()->ItemAt(i); i++) {
|
||||||
@@ -164,6 +164,26 @@ BToolBar::SetActionVisible(uint32 command, bool visible)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BButton*
|
||||||
|
BToolBar::FindButton(uint32 command) const
|
||||||
|
{
|
||||||
|
for (int32 i = 0; BView* view = ChildAt(i); i++) {
|
||||||
|
BButton* button = dynamic_cast<BButton*>(view);
|
||||||
|
if (button == NULL)
|
||||||
|
continue;
|
||||||
|
BMessage* message = button->Message();
|
||||||
|
if (message == NULL)
|
||||||
|
continue;
|
||||||
|
if (message->what == command) {
|
||||||
|
return button;
|
||||||
|
// Assumes there is only one button with this message...
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Private methods
|
// #pragma mark - Private methods
|
||||||
|
|
||||||
|
|
||||||
@@ -197,26 +217,6 @@ BToolBar::_Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BButton*
|
|
||||||
BToolBar::_FindButton(uint32 command) const
|
|
||||||
{
|
|
||||||
for (int32 i = 0; BView* view = ChildAt(i); i++) {
|
|
||||||
BButton* button = dynamic_cast<BButton*>(view);
|
|
||||||
if (button == NULL)
|
|
||||||
continue;
|
|
||||||
BMessage* message = button->Message();
|
|
||||||
if (message == NULL)
|
|
||||||
continue;
|
|
||||||
if (message->what == command) {
|
|
||||||
return button;
|
|
||||||
// Assumes there is only one button with this message...
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BToolBar::_HideToolTips() const
|
BToolBar::_HideToolTips() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user