* Switch from using BMenuField to BTabView for panel selection

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36526 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ithamar R. Adema
2010-04-29 11:59:50 +00:00
parent 5151639147
commit 037e8a50ff
3 changed files with 18 additions and 38 deletions
@@ -10,6 +10,7 @@
#include <Roster.h>
#include <StorageKit.h>
#include <SupportKit.h>
#include <TabView.h>
#include <stdio.h>
#include <string.h>
@@ -26,9 +27,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
BWindow(BRect(100, 100, 300, 300), title, B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
BMenu *showPopup = new BPopUpMenu("<please select me!>");
_BuildShowMenu(showPopup, SHOW_MSG);
BBox *topDivider = new BBox(B_EMPTY_STRING);
topDivider->SetBorder(B_PLAIN_BORDER);
@@ -46,13 +44,7 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
// ---- Settings section
// Make the show popup field half the whole width and centered
BMenuField *showMenuField = new BMenuField("show_menu",
TR("Show:"), showPopup);
showMenuField->SetFont(be_bold_font);
fPanel = new BBox("showview_box");
fPanel->SetBorder(B_NO_BORDER);
fPanel = new BTabView("showview_box");
// ---- Bottom globals buttons section
BBox *bottomDivider = new BBox(B_EMPTY_STRING);
@@ -82,7 +74,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
.Add(button)
.End()
.Add(topDivider)
.Add(showMenuField)
.Add(fPanel)
.Add(bottomDivider)
.AddGroup(B_HORIZONTAL, 5)
@@ -93,6 +84,8 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
.SetInsets(10, 10, 10, 10)
);
_BuildShowTabView(SHOW_MSG);
topDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
bottomDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
@@ -227,9 +220,8 @@ NetworkSetupWindow::_BuildProfilesMenu(BMenu* menu, int32 msg_what)
void
NetworkSetupWindow::_BuildShowMenu(BMenu* menu, int32 msg_what)
NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
{
menu->SetRadioMode(true);
BPath path;
BPath addon_path;
BDirectory dir;
@@ -295,7 +287,10 @@ NetworkSetupWindow::_BuildShowMenu(BMenu* menu, int32 msg_what)
msg->AddString("addon_path", addon_path.Path());
msg->AddPointer("addon", addon);
msg->AddPointer("addon_view", addon_view);
menu->AddItem(new BMenuItem(addon->Name(), msg));
BTab *tab = new BTab;
fPanel->AddTab(addon_view,tab);
tab->SetLabel(addon->Name());
n++;
}
continue;
@@ -1,8 +1,13 @@
#ifndef NETWORKSETUPWINDOW_H
#define NETWORKSETUPWINDOW_H
class NetworkSetupWindow;
#include <InterfaceKit.h>
#include <Window.h>
class BTabView;
class BButton;
class BMenu;
class NetworkSetupWindow : public BWindow
{
@@ -27,17 +32,16 @@ class NetworkSetupWindow : public BWindow
bool QuitRequested();
void MessageReceived(BMessage* msg);
void AttachedToWindow();
private:
void _BuildProfilesMenu(BMenu* menu, int32 msg);
void _BuildShowMenu(BMenu* menu, int32 msg);
void _BuildShowTabView(int32 msg);
BButton* fHelpButton;
BButton* fRevertButton;
BButton* fApplyNowButton;
BBox* fPanel;
BTabView* fPanel;
BView* fAddonView;
BRect fMinAddonViewRect;
};
@@ -12,7 +12,7 @@ class ServicesAddOn : public NetworkSetupAddOn {
public:
ServicesAddOn(image_id addon_image);
BView* CreateView(BRect* bounds);
const char* Name() { return "Internet services"; };
const char* Name() { return "Services"; };
};
@@ -83,22 +83,3 @@ ServicesAddOn::CreateView(BRect* bounds)
*bounds = r;
return sv;
}
/*
BDirectory folder;
BEntry entry;
folder.SetTo ( "/boot/beos/etc/bubblejet" );
if ( folder.InitCheck() != B_OK )
return;
while ( folder.GetNextEntry ( &entry ) != B_ENTRY_NOT_FOUND )
{
char name[B_FILE_NAME_LENGTH];
if ( entry.GetName(name) == B_NO_ERROR )
m_model_list->AddItem (new BStringItem(name));
};
m_model_list->SetSelectionMessage(new BMessage(MODEL_MSG));
m_model_list->SetInvocationMessage(new BMessage(OK_MSG));
*/