Add basic tabbed browsing support. Does not yet properly handle maintaining/switching the current URL or status bar text per-tab.
git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@152 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
#include "AuthenticationPanel.h"
|
#include "AuthenticationPanel.h"
|
||||||
#include "BrowsingHistory.h"
|
#include "BrowsingHistory.h"
|
||||||
#include "WebPage.h"
|
#include "WebPage.h"
|
||||||
|
#include "WebTabView.h"
|
||||||
#include "WebView.h"
|
#include "WebView.h"
|
||||||
#include "WebViewConstants.h"
|
#include "WebViewConstants.h"
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
@@ -88,16 +89,26 @@ LauncherWindow::LauncherWindow(BRect frame, const BMessenger& downloadListener,
|
|||||||
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||||
B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS)
|
B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS)
|
||||||
{
|
{
|
||||||
setCurrentWebView(new WebView("web_view"));
|
m_tabView = new WebTabView("tabview", BMessenger(this));
|
||||||
|
WebView *webView = new WebView("web_view");
|
||||||
|
m_tabView->AddTab(webView);
|
||||||
|
m_tabView->TabAt(0L)->SetLabel("New Tab");
|
||||||
|
setCurrentWebView(webView);
|
||||||
|
|
||||||
if (toolbarPolicy == HaveToolbar) {
|
if (toolbarPolicy == HaveToolbar) {
|
||||||
// Menu
|
// Menu
|
||||||
m_menuBar = new BMenuBar("Main menu");
|
m_menuBar = new BMenuBar("Main menu");
|
||||||
BMenu* menu = new BMenu("Window");
|
BMenu* menu = new BMenu("Window");
|
||||||
BMessage* newWindowMessage = new BMessage(NEW_WINDOW);
|
BMessage* newWindowMessage = new BMessage(NEW_WINDOW);
|
||||||
newWindowMessage->AddString("url", "");
|
newWindowMessage->AddString("url", "");
|
||||||
BMenuItem* newItem = new BMenuItem("New", newWindowMessage, 'N');
|
BMenu *newMenu = new BMenu("New");
|
||||||
menu->AddItem(newItem);
|
BMenuItem* newItem = new BMenuItem("Window", newWindowMessage, 'N');
|
||||||
|
newMenu->AddItem(newItem);
|
||||||
newItem->SetTarget(be_app);
|
newItem->SetTarget(be_app);
|
||||||
|
newItem = new BMenuItem("Tab", new BMessage(NEW_TAB), 'T');
|
||||||
|
newMenu->AddItem(newItem);
|
||||||
|
newItem->SetTarget(this);
|
||||||
|
menu->AddItem(newMenu);
|
||||||
menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W'));
|
menu->AddItem(new BMenuItem("Close", new BMessage(B_QUIT_REQUESTED), 'W'));
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem("Show Downloads", new BMessage(SHOW_DOWNLOAD_WINDOW), 'D'));
|
menu->AddItem(new BMenuItem("Show Downloads", new BMessage(SHOW_DOWNLOAD_WINDOW), 'D'));
|
||||||
@@ -175,7 +186,7 @@ LauncherWindow::LauncherWindow(BRect frame, const BMessenger& downloadListener,
|
|||||||
.SetInsets(kInsetSpacing, kInsetSpacing, kInsetSpacing, kInsetSpacing)
|
.SetInsets(kInsetSpacing, kInsetSpacing, kInsetSpacing, kInsetSpacing)
|
||||||
)
|
)
|
||||||
.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
|
.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
|
||||||
.Add(currentWebView())
|
.Add(m_tabView)
|
||||||
.Add(findGroup)
|
.Add(findGroup)
|
||||||
.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
|
.Add(new BSeparatorView(B_HORIZONTAL, B_PLAIN_BORDER))
|
||||||
.Add(BGroupLayoutBuilder(B_HORIZONTAL, kElementSpacing)
|
.Add(BGroupLayoutBuilder(B_HORIZONTAL, kElementSpacing)
|
||||||
@@ -240,20 +251,20 @@ void LauncherWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CLEAR_HISTORY: {
|
case CLEAR_HISTORY: {
|
||||||
BrowsingHistory* history = BrowsingHistory::defaultInstance();
|
BrowsingHistory* history = BrowsingHistory::defaultInstance();
|
||||||
if (history->countItems() == 0)
|
if (history->countItems() == 0)
|
||||||
break;
|
break;
|
||||||
BAlert* alert = new BAlert("Confirmation", "Do you really want to clear "
|
BAlert* alert = new BAlert("Confirmation", "Do you really want to clear "
|
||||||
"the browsing history?", "Clear", "Cancel");
|
"the browsing history?", "Clear", "Cancel");
|
||||||
if (alert->Go() == 0)
|
if (alert->Go() == 0)
|
||||||
history->clear();
|
history->clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case B_SIMPLE_DATA: {
|
case B_SIMPLE_DATA: {
|
||||||
// User possibly dropped files on this window.
|
// User possibly dropped files on this window.
|
||||||
// If there is more than one entry_ref, let the app handle it (open one
|
// If there is more than one entry_ref, let the app handle it (open one
|
||||||
// new page per ref). If there is one ref, open it in this window.
|
// new page per ref). If there is one ref, open it in this window.
|
||||||
type_code type;
|
type_code type;
|
||||||
int32 countFound;
|
int32 countFound;
|
||||||
if (message->GetInfo("refs", &type, &countFound) != B_OK
|
if (message->GetInfo("refs", &type, &countFound) != B_OK
|
||||||
@@ -309,6 +320,24 @@ void LauncherWindow::MessageReceived(BMessage* message)
|
|||||||
be_app->PostMessage(message);
|
be_app->PostMessage(message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case NEW_TAB:
|
||||||
|
{
|
||||||
|
m_tabView->AddTab(new WebView("web_view"));
|
||||||
|
m_tabView->TabAt(m_tabView->CountTabs() - 1)->SetLabel("New Tab");
|
||||||
|
m_tabView->DrawTabs();
|
||||||
|
m_tabView->Select(m_tabView->CountTabs() - 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case TAB_CHANGED:
|
||||||
|
{
|
||||||
|
int32 index = message->FindInt32("index");
|
||||||
|
setCurrentWebView(dynamic_cast<WebView *>(
|
||||||
|
m_tabView->ViewForTab(index)));
|
||||||
|
updateTitle(m_tabView->TabAt(index)->Label());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WebViewWindow::MessageReceived(message);
|
WebViewWindow::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@@ -334,9 +363,9 @@ bool LauncherWindow::QuitRequested()
|
|||||||
|
|
||||||
void LauncherWindow::MenusBeginning()
|
void LauncherWindow::MenusBeginning()
|
||||||
{
|
{
|
||||||
BMenuItem* menuItem;
|
BMenuItem* menuItem;
|
||||||
while ((menuItem = m_goMenu->RemoveItem(0L)))
|
while ((menuItem = m_goMenu->RemoveItem(0L)))
|
||||||
delete menuItem;
|
delete menuItem;
|
||||||
|
|
||||||
BrowsingHistory* history = BrowsingHistory::defaultInstance();
|
BrowsingHistory* history = BrowsingHistory::defaultInstance();
|
||||||
if (!history->Lock())
|
if (!history->Lock())
|
||||||
@@ -344,14 +373,14 @@ void LauncherWindow::MenusBeginning()
|
|||||||
|
|
||||||
int32 count = history->countItems();
|
int32 count = history->countItems();
|
||||||
for (int32 i = 0; i < count; i++) {
|
for (int32 i = 0; i < count; i++) {
|
||||||
BrowsingHistoryItem historyItem = history->historyItemAt(i);
|
BrowsingHistoryItem historyItem = history->historyItemAt(i);
|
||||||
BMessage* message = new BMessage(GOTO_URL);
|
BMessage* message = new BMessage(GOTO_URL);
|
||||||
message->AddString("url", historyItem.url().String());
|
message->AddString("url", historyItem.url().String());
|
||||||
// TODO: More sophisticated menu structure... sorted by days/weeks...
|
// TODO: More sophisticated menu structure... sorted by days/weeks...
|
||||||
BString truncatedUrl(historyItem.url());
|
BString truncatedUrl(historyItem.url());
|
||||||
be_plain_font->TruncateString(&truncatedUrl, B_TRUNCATE_END, 480);
|
be_plain_font->TruncateString(&truncatedUrl, B_TRUNCATE_END, 480);
|
||||||
menuItem = new BMenuItem(truncatedUrl, message);
|
menuItem = new BMenuItem(truncatedUrl, message);
|
||||||
m_goMenu->AddItem(menuItem);
|
m_goMenu->AddItem(menuItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -367,7 +396,7 @@ void LauncherWindow::MenusBeginning()
|
|||||||
|
|
||||||
void LauncherWindow::navigationRequested(const BString& url, WebView* view)
|
void LauncherWindow::navigationRequested(const BString& url, WebView* view)
|
||||||
{
|
{
|
||||||
// TODO: Move elsewhere, doesn't belong here.
|
// TODO: Move elsewhere, doesn't belong here.
|
||||||
m_loadedURL = url;
|
m_loadedURL = url;
|
||||||
if (m_url)
|
if (m_url)
|
||||||
m_url->SetText(url.String());
|
m_url->SetText(url.String());
|
||||||
@@ -400,8 +429,8 @@ void LauncherWindow::loadTransfering(const BString& url, WebView* view)
|
|||||||
|
|
||||||
void LauncherWindow::loadProgress(float progress, WebView* view)
|
void LauncherWindow::loadProgress(float progress, WebView* view)
|
||||||
{
|
{
|
||||||
if (view != currentWebView())
|
if (view != currentWebView())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_loadingProgressBar) {
|
if (m_loadingProgressBar) {
|
||||||
if (progress < 100 && m_loadingProgressBar->IsHidden())
|
if (progress < 100 && m_loadingProgressBar->IsHidden())
|
||||||
@@ -412,8 +441,8 @@ void LauncherWindow::loadProgress(float progress, WebView* view)
|
|||||||
|
|
||||||
void LauncherWindow::loadFailed(const BString& url, WebView* view)
|
void LauncherWindow::loadFailed(const BString& url, WebView* view)
|
||||||
{
|
{
|
||||||
if (view != currentWebView())
|
if (view != currentWebView())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BString status(url);
|
BString status(url);
|
||||||
status << " failed.";
|
status << " failed.";
|
||||||
@@ -424,8 +453,8 @@ void LauncherWindow::loadFailed(const BString& url, WebView* view)
|
|||||||
|
|
||||||
void LauncherWindow::loadFinished(const BString& url, WebView* view)
|
void LauncherWindow::loadFinished(const BString& url, WebView* view)
|
||||||
{
|
{
|
||||||
if (view != currentWebView())
|
if (view != currentWebView())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_loadedURL = url;
|
m_loadedURL = url;
|
||||||
BString status(url);
|
BString status(url);
|
||||||
@@ -439,8 +468,8 @@ void LauncherWindow::loadFinished(const BString& url, WebView* view)
|
|||||||
|
|
||||||
void LauncherWindow::resizeRequested(float width, float height, WebView* view)
|
void LauncherWindow::resizeRequested(float width, float height, WebView* view)
|
||||||
{
|
{
|
||||||
if (view != currentWebView())
|
if (view != currentWebView())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: Ignore request when there is more than one WebView embedded!
|
// TODO: Ignore request when there is more than one WebView embedded!
|
||||||
|
|
||||||
@@ -449,19 +478,19 @@ void LauncherWindow::resizeRequested(float width, float height, WebView* view)
|
|||||||
|
|
||||||
void LauncherWindow::setToolBarsVisible(bool flag, WebView* view)
|
void LauncherWindow::setToolBarsVisible(bool flag, WebView* view)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
// TODO: Ignore request when there is more than one WebView embedded!
|
// TODO: Ignore request when there is more than one WebView embedded!
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherWindow::setStatusBarVisible(bool flag, WebView* view)
|
void LauncherWindow::setStatusBarVisible(bool flag, WebView* view)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
// TODO: Ignore request when there is more than one WebView embedded!
|
// TODO: Ignore request when there is more than one WebView embedded!
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherWindow::setMenuBarVisible(bool flag, WebView* view)
|
void LauncherWindow::setMenuBarVisible(bool flag, WebView* view)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
// TODO: Ignore request when there is more than one WebView embedded!
|
// TODO: Ignore request when there is more than one WebView embedded!
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,20 +506,24 @@ void LauncherWindow::setResizable(bool flag, WebView* view)
|
|||||||
|
|
||||||
void LauncherWindow::titleChanged(const BString& title, WebView* view)
|
void LauncherWindow::titleChanged(const BString& title, WebView* view)
|
||||||
{
|
{
|
||||||
if (view != currentWebView())
|
for (int32 i = 0; i < m_tabView->CountTabs(); i++)
|
||||||
return;
|
{
|
||||||
|
if (m_tabView->ViewForTab(i) == view) {
|
||||||
|
m_tabView->TabAt(i)->SetLabel(title);
|
||||||
|
m_tabView->DrawTabs();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (view != currentWebView())
|
||||||
|
return;
|
||||||
|
|
||||||
BString windowTitle = title;
|
updateTitle(title);
|
||||||
if (windowTitle.Length() > 0)
|
|
||||||
windowTitle << " - ";
|
|
||||||
windowTitle << "HaikuLauncher";
|
|
||||||
SetTitle(windowTitle.String());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherWindow::statusChanged(const BString& statusText, WebView* view)
|
void LauncherWindow::statusChanged(const BString& statusText, WebView* view)
|
||||||
{
|
{
|
||||||
if (view != currentWebView())
|
if (view != currentWebView())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_statusText)
|
if (m_statusText)
|
||||||
m_statusText->SetText(statusText.String());
|
m_statusText->SetText(statusText.String());
|
||||||
@@ -499,8 +532,8 @@ void LauncherWindow::statusChanged(const BString& statusText, WebView* view)
|
|||||||
void LauncherWindow::navigationCapabilitiesChanged(bool canGoBackward,
|
void LauncherWindow::navigationCapabilitiesChanged(bool canGoBackward,
|
||||||
bool canGoForward, bool canStop, WebView* view)
|
bool canGoForward, bool canStop, WebView* view)
|
||||||
{
|
{
|
||||||
if (view != currentWebView())
|
if (view != currentWebView())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_BackButton)
|
if (m_BackButton)
|
||||||
m_BackButton->SetEnabled(canGoBackward);
|
m_BackButton->SetEnabled(canGoBackward);
|
||||||
@@ -510,7 +543,7 @@ void LauncherWindow::navigationCapabilitiesChanged(bool canGoBackward,
|
|||||||
|
|
||||||
void LauncherWindow::updateGlobalHistory(const BString& url)
|
void LauncherWindow::updateGlobalHistory(const BString& url)
|
||||||
{
|
{
|
||||||
BrowsingHistory::defaultInstance()->addItem(BrowsingHistoryItem(url));
|
BrowsingHistory::defaultInstance()->addItem(BrowsingHistoryItem(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherWindow::authenticationChallenge(BMessage* message)
|
void LauncherWindow::authenticationChallenge(BMessage* message)
|
||||||
@@ -539,3 +572,12 @@ void LauncherWindow::authenticationChallenge(BMessage* message)
|
|||||||
reply.AddBool("rememberCredentials", rememberCredentials);
|
reply.AddBool("rememberCredentials", rememberCredentials);
|
||||||
message->SendReply(&reply);
|
message->SendReply(&reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LauncherWindow::updateTitle(const BString& title)
|
||||||
|
{
|
||||||
|
BString windowTitle = title;
|
||||||
|
if (windowTitle.Length() > 0)
|
||||||
|
windowTitle << " - ";
|
||||||
|
windowTitle << "HaikuLauncher";
|
||||||
|
SetTitle(windowTitle.String());
|
||||||
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class BLayoutItem;
|
|||||||
class BMenu;
|
class BMenu;
|
||||||
class BStatusBar;
|
class BStatusBar;
|
||||||
class BStringView;
|
class BStringView;
|
||||||
|
class BTabView;
|
||||||
class BTextControl;
|
class BTextControl;
|
||||||
class WebView;
|
class WebView;
|
||||||
|
|
||||||
@@ -48,9 +49,10 @@ enum ToolbarPolicy {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NEW_WINDOW = 'nwnd',
|
NEW_WINDOW = 'nwnd',
|
||||||
WINDOW_OPENED = 'wndo',
|
NEW_TAB = 'ntab',
|
||||||
WINDOW_CLOSED = 'wndc',
|
WINDOW_OPENED = 'wndo',
|
||||||
|
WINDOW_CLOSED = 'wndc',
|
||||||
SHOW_DOWNLOAD_WINDOW = 'sdwd'
|
SHOW_DOWNLOAD_WINDOW = 'sdwd'
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,6 +86,7 @@ private:
|
|||||||
bool canGoForward, bool canStop, WebView* view);
|
bool canGoForward, bool canStop, WebView* view);
|
||||||
virtual void updateGlobalHistory(const BString& url);
|
virtual void updateGlobalHistory(const BString& url);
|
||||||
virtual void authenticationChallenge(BMessage* challenge);
|
virtual void authenticationChallenge(BMessage* challenge);
|
||||||
|
void updateTitle(const BString &title);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMenuBar* m_menuBar;
|
BMenuBar* m_menuBar;
|
||||||
@@ -97,6 +100,7 @@ private:
|
|||||||
BLayoutItem* m_findGroup;
|
BLayoutItem* m_findGroup;
|
||||||
BTextControl* m_findTextControl;
|
BTextControl* m_findTextControl;
|
||||||
BCheckBox* m_findCaseSensitiveCheckBox;
|
BCheckBox* m_findCaseSensitiveCheckBox;
|
||||||
|
BTabView* m_tabView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LauncherWindow_h
|
#endif // LauncherWindow_h
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010 Rene Gollent <[email protected]>
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "WebTabView.h"
|
||||||
|
|
||||||
|
WebTabView::WebTabView(const char *name, const BMessenger& target)
|
||||||
|
: BTabView(name)
|
||||||
|
, m_target(target)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
WebTabView::~WebTabView(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
WebTabView::Select(int32 tab)
|
||||||
|
{
|
||||||
|
BTabView::Select(tab);
|
||||||
|
BMessage message(TAB_CHANGED);
|
||||||
|
message.AddInt32("index", tab);
|
||||||
|
m_target.SendMessage(&message);
|
||||||
|
}
|
||||||
|
|
||||||
|
const BMessenger& WebTabView::Target(void) const
|
||||||
|
{
|
||||||
|
return m_target;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebTabView::SetTarget(const BMessenger& target)
|
||||||
|
{
|
||||||
|
m_target = target;
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2010 Rene Gollent <[email protected]>
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
|
||||||
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||||
|
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WebTabView_h
|
||||||
|
#define WebTabView_h
|
||||||
|
|
||||||
|
#include <Messenger.h>
|
||||||
|
#include <TabView.h>
|
||||||
|
|
||||||
|
enum {
|
||||||
|
TAB_CHANGED = 'tcha'
|
||||||
|
};
|
||||||
|
|
||||||
|
class WebTabView : public BTabView {
|
||||||
|
public:
|
||||||
|
WebTabView(const char *name, const BMessenger& target);
|
||||||
|
virtual ~WebTabView(void);
|
||||||
|
virtual void Select(int32 tab);
|
||||||
|
|
||||||
|
const BMessenger& Target(void) const;
|
||||||
|
void SetTarget(const BMessenger& target);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BMessenger m_target;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define WebTabView_h
|
||||||
|
#endif // WebTabView_h
|
||||||
Reference in New Issue
Block a user