2021-07-23 23:43:42 -05:00
|
|
|
/*
|
|
|
|
* Copyright 2021, Jaidyn Levesque <jadedctrl@teknik.io>
|
|
|
|
* All rights reserved. Distributed under the terms of the MIT license.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "MenuButton.h"
|
|
|
|
|
|
|
|
#include <PopUpMenu.h>
|
|
|
|
|
|
|
|
|
|
|
|
MenuButton::MenuButton(const char* name, const char* label, BMessage* message)
|
|
|
|
:
|
2021-08-02 12:12:54 -05:00
|
|
|
BButton(name, label, message),
|
2021-07-23 23:43:42 -05:00
|
|
|
fMenu(NULL)
|
|
|
|
{
|
2021-08-02 12:12:54 -05:00
|
|
|
SetBehavior(B_POP_UP_BEHAVIOR);
|
2021-07-23 23:43:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
MenuButton::MouseDown(BPoint where)
|
|
|
|
{
|
|
|
|
BButton::MouseDown(where);
|
|
|
|
if (fMenu != NULL)
|
2021-08-02 12:12:54 -05:00
|
|
|
fMenu->Go(ConvertToScreen(Bounds().LeftBottom()), true, true, true);
|
2021-07-23 23:43:42 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
MenuButton::MouseUp(BPoint where)
|
|
|
|
{
|
|
|
|
BButton::MouseUp(where);
|
|
|
|
SetValue(B_CONTROL_OFF);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
MenuButton::MouseMoved(BPoint where, uint32 code, const BMessage* dragMsg)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BPopUpMenu*
|
|
|
|
MenuButton::Menu()
|
|
|
|
{
|
|
|
|
return fMenu;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
MenuButton::SetMenu(BPopUpMenu* menu)
|
|
|
|
{
|
|
|
|
fMenu = menu;
|
|
|
|
}
|