style tab cleanup; start using classy kMsg style BMessage vars; no functional change
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40599 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -35,7 +35,7 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
|||||||
{
|
{
|
||||||
// ---- Profiles section
|
// ---- Profiles section
|
||||||
BMenu *profilesPopup = new BPopUpMenu("<none>");
|
BMenu *profilesPopup = new BPopUpMenu("<none>");
|
||||||
_BuildProfilesMenu(profilesPopup, SELECT_PROFILE_MSG);
|
_BuildProfilesMenu(profilesPopup, kMsgProfileSelected);
|
||||||
|
|
||||||
BMenuField *profilesMenuField = new BMenuField("profiles_menu",
|
BMenuField *profilesMenuField = new BMenuField("profiles_menu",
|
||||||
B_TRANSLATE("Profile:"), profilesPopup);
|
B_TRANSLATE("Profile:"), profilesPopup);
|
||||||
@@ -51,10 +51,10 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
|||||||
bottomDivider->SetBorder(B_PLAIN_BORDER);
|
bottomDivider->SetBorder(B_PLAIN_BORDER);
|
||||||
|
|
||||||
fApplyButton = new BButton("apply", B_TRANSLATE("Apply"),
|
fApplyButton = new BButton("apply", B_TRANSLATE("Apply"),
|
||||||
new BMessage(APPLY_NOW_MSG));
|
new BMessage(kMsgApply));
|
||||||
|
|
||||||
fRevertButton = new BButton("revert", B_TRANSLATE("Revert"),
|
fRevertButton = new BButton("revert", B_TRANSLATE("Revert"),
|
||||||
new BMessage(REVERT_MSG));
|
new BMessage(kMsgRevert));
|
||||||
fRevertButton->SetEnabled(false);
|
fRevertButton->SetEnabled(false);
|
||||||
|
|
||||||
// Enable boxes resizing modes
|
// Enable boxes resizing modes
|
||||||
@@ -78,7 +78,7 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
|
|||||||
.SetInsets(10, 10, 10, 10)
|
.SetInsets(10, 10, 10, 10)
|
||||||
);
|
);
|
||||||
|
|
||||||
_BuildShowTabView(SHOW_MSG);
|
_BuildShowTabView(kMsgAddonShow);
|
||||||
|
|
||||||
bottomDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
|
bottomDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
|
||||||
fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
|
fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
|
||||||
@@ -107,44 +107,43 @@ void
|
|||||||
NetworkSetupWindow::MessageReceived(BMessage* msg)
|
NetworkSetupWindow::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
|
case kMsgProfileNew:
|
||||||
case NEW_PROFILE_MSG:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SELECT_PROFILE_MSG: {
|
|
||||||
BPath name;
|
|
||||||
const char *path;
|
|
||||||
bool is_default;
|
|
||||||
bool is_current;
|
|
||||||
|
|
||||||
if (msg->FindString("path", &path) != B_OK)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
name.SetTo(path);
|
case kMsgProfileSelected: {
|
||||||
|
BPath name;
|
||||||
|
const char *path;
|
||||||
|
bool is_default;
|
||||||
|
bool is_current;
|
||||||
|
|
||||||
is_default = (strcmp(name.Leaf(), "default") == 0);
|
if (msg->FindString("path", &path) != B_OK)
|
||||||
is_current = (strcmp(name.Leaf(), "current") == 0);
|
break;
|
||||||
|
|
||||||
fApplyButton->SetEnabled(!is_current);
|
name.SetTo(path);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case SHOW_MSG: {
|
is_default = (strcmp(name.Leaf(), "default") == 0);
|
||||||
if (fAddonView)
|
is_current = (strcmp(name.Leaf(), "current") == 0);
|
||||||
fAddonView->RemoveSelf();
|
|
||||||
|
|
||||||
fAddonView = NULL;
|
fApplyButton->SetEnabled(!is_current);
|
||||||
if (msg->FindPointer("addon_view", (void **) &fAddonView) != B_OK)
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
fPanel->AddChild(fAddonView);
|
case kMsgAddonShow: {
|
||||||
fAddonView->ResizeTo(fPanel->Bounds().Width(),
|
if (fAddonView)
|
||||||
fPanel->Bounds().Height());
|
fAddonView->RemoveSelf();
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
fAddonView = NULL;
|
||||||
inherited::MessageReceived(msg);
|
if (msg->FindPointer("addon_view", (void **) &fAddonView) != B_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
|
fPanel->AddChild(fAddonView);
|
||||||
|
fAddonView->ResizeTo(fPanel->Bounds().Width(),
|
||||||
|
fPanel->Bounds().Height());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
inherited::MessageReceived(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,9 +192,9 @@ NetworkSetupWindow::_BuildProfilesMenu(BMenu* menu, int32 msg_what)
|
|||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("New" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(NEW_PROFILE_MSG)));
|
new BMessage(kMsgProfileNew)));
|
||||||
menu->AddItem(new BMenuItem(B_TRANSLATE("Manage" B_UTF8_ELLIPSIS),
|
menu->AddItem(new BMenuItem(B_TRANSLATE("Manage" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(MANAGE_PROFILES_MSG)));
|
new BMessage(kMsgProfileManage)));
|
||||||
|
|
||||||
if (strlen(current_profile)) {
|
if (strlen(current_profile)) {
|
||||||
item = menu->FindItem(current_profile);
|
item = menu->FindItem(current_profile);
|
||||||
|
|||||||
@@ -18,38 +18,34 @@ class BMenu;
|
|||||||
class NetworkSetupWindow : public BWindow
|
class NetworkSetupWindow : public BWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NetworkSetupWindow(const char *title);
|
NetworkSetupWindow(const char *title);
|
||||||
~NetworkSetupWindow();
|
~NetworkSetupWindow();
|
||||||
|
|
||||||
typedef BWindow inherited;
|
|
||||||
|
|
||||||
enum {
|
typedef BWindow inherited;
|
||||||
SELECT_PROFILE_MSG = 'prof',
|
|
||||||
MANAGE_PROFILES_MSG = 'mngp',
|
static const uint32 kMsgAddonShow = 'show';
|
||||||
NEW_PROFILE_MSG = 'newp',
|
static const uint32 kMsgProfileSelected = 'prof';
|
||||||
COPY_PROFILE_MSG = 'cpyp',
|
static const uint32 kMsgProfileManage = 'mngp';
|
||||||
DELETE_PROFILE_MSG = 'delp',
|
static const uint32 kMsgProfileNew = 'newp';
|
||||||
SHOW_MSG = 'show',
|
static const uint32 kMsgApply = 'aply';
|
||||||
HELP_MSG = 'help',
|
static const uint32 kMsgRevert = 'rvrt';
|
||||||
DONT_TOUCH_MSG = 'lock',
|
|
||||||
APPLY_NOW_MSG = 'aply',
|
bool QuitRequested();
|
||||||
REVERT_MSG = 'rvrt'
|
void MessageReceived(BMessage* msg);
|
||||||
};
|
|
||||||
|
|
||||||
bool QuitRequested();
|
|
||||||
void MessageReceived(BMessage* msg);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _BuildProfilesMenu(BMenu* menu, int32 msg);
|
void _BuildProfilesMenu(BMenu* menu, int32 msg);
|
||||||
void _BuildShowTabView(int32 msg);
|
void _BuildShowTabView(int32 msg);
|
||||||
|
|
||||||
BButton* fHelpButton;
|
|
||||||
BButton* fRevertButton;
|
|
||||||
BButton* fApplyButton;
|
|
||||||
|
|
||||||
BTabView* fPanel;
|
BButton* fHelpButton;
|
||||||
BView* fAddonView;
|
BButton* fRevertButton;
|
||||||
BRect fMinAddonViewRect;
|
BButton* fApplyButton;
|
||||||
|
|
||||||
|
BTabView* fPanel;
|
||||||
|
BView* fAddonView;
|
||||||
|
BRect fMinAddonViewRect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // ifdef NETWORKSETUPWINDOW_H
|
#endif // ifdef NETWORKSETUPWINDOW_H
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user