* 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 <Roster.h>
#include <StorageKit.h> #include <StorageKit.h>
#include <SupportKit.h> #include <SupportKit.h>
#include <TabView.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -26,9 +27,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
BWindow(BRect(100, 100, 300, 300), title, B_TITLED_WINDOW, BWindow(BRect(100, 100, 300, 300), title, B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) 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); BBox *topDivider = new BBox(B_EMPTY_STRING);
topDivider->SetBorder(B_PLAIN_BORDER); topDivider->SetBorder(B_PLAIN_BORDER);
@@ -46,13 +44,7 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
// ---- Settings section // ---- Settings section
// Make the show popup field half the whole width and centered fPanel = new BTabView("showview_box");
BMenuField *showMenuField = new BMenuField("show_menu",
TR("Show:"), showPopup);
showMenuField->SetFont(be_bold_font);
fPanel = new BBox("showview_box");
fPanel->SetBorder(B_NO_BORDER);
// ---- Bottom globals buttons section // ---- Bottom globals buttons section
BBox *bottomDivider = new BBox(B_EMPTY_STRING); BBox *bottomDivider = new BBox(B_EMPTY_STRING);
@@ -82,7 +74,6 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
.Add(button) .Add(button)
.End() .End()
.Add(topDivider) .Add(topDivider)
.Add(showMenuField)
.Add(fPanel) .Add(fPanel)
.Add(bottomDivider) .Add(bottomDivider)
.AddGroup(B_HORIZONTAL, 5) .AddGroup(B_HORIZONTAL, 5)
@@ -93,6 +84,8 @@ NetworkSetupWindow::NetworkSetupWindow(const char *title)
.SetInsets(10, 10, 10, 10) .SetInsets(10, 10, 10, 10)
); );
_BuildShowTabView(SHOW_MSG);
topDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1)); topDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
bottomDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1)); bottomDivider->SetExplicitMaxSize(BSize(B_SIZE_UNSET, 1));
fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(), fPanel->SetExplicitMinSize(BSize(fMinAddonViewRect.Width(),
@@ -227,9 +220,8 @@ NetworkSetupWindow::_BuildProfilesMenu(BMenu* menu, int32 msg_what)
void void
NetworkSetupWindow::_BuildShowMenu(BMenu* menu, int32 msg_what) NetworkSetupWindow::_BuildShowTabView(int32 msg_what)
{ {
menu->SetRadioMode(true);
BPath path; BPath path;
BPath addon_path; BPath addon_path;
BDirectory dir; BDirectory dir;
@@ -295,7 +287,10 @@ NetworkSetupWindow::_BuildShowMenu(BMenu* menu, int32 msg_what)
msg->AddString("addon_path", addon_path.Path()); msg->AddString("addon_path", addon_path.Path());
msg->AddPointer("addon", addon); msg->AddPointer("addon", addon);
msg->AddPointer("addon_view", addon_view); 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++; n++;
} }
continue; continue;
@@ -1,8 +1,13 @@
#ifndef NETWORKSETUPWINDOW_H #ifndef NETWORKSETUPWINDOW_H
#define NETWORKSETUPWINDOW_H #define NETWORKSETUPWINDOW_H
class NetworkSetupWindow;
#include <InterfaceKit.h> #include <Window.h>
class BTabView;
class BButton;
class BMenu;
class NetworkSetupWindow : public BWindow class NetworkSetupWindow : public BWindow
{ {
@@ -27,17 +32,16 @@ class NetworkSetupWindow : public BWindow
bool QuitRequested(); bool QuitRequested();
void MessageReceived(BMessage* msg); void MessageReceived(BMessage* msg);
void AttachedToWindow();
private: private:
void _BuildProfilesMenu(BMenu* menu, int32 msg); void _BuildProfilesMenu(BMenu* menu, int32 msg);
void _BuildShowMenu(BMenu* menu, int32 msg); void _BuildShowTabView(int32 msg);
BButton* fHelpButton; BButton* fHelpButton;
BButton* fRevertButton; BButton* fRevertButton;
BButton* fApplyNowButton; BButton* fApplyNowButton;
BBox* fPanel; BTabView* fPanel;
BView* fAddonView; BView* fAddonView;
BRect fMinAddonViewRect; BRect fMinAddonViewRect;
}; };
@@ -12,7 +12,7 @@ class ServicesAddOn : public NetworkSetupAddOn {
public: public:
ServicesAddOn(image_id addon_image); ServicesAddOn(image_id addon_image);
BView* CreateView(BRect* bounds); 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; *bounds = r;
return sv; 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));
*/