Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implement title property for windows.

[TIMOB-12932]
  • Loading branch information...
commit c68e8b16f3a6db7c0172c13613381fa3723c0537 1 parent fff9f5e
Joshua Roesslein authored
View
7 src/tibb/NativeWindowObject.cpp
@@ -13,6 +13,7 @@
#include <bb/cascades/Application>
#include <bb/cascades/Image>
#include <bb/cascades/Page>
+#include <bb/cascades/TitleBar>
#include <bb/device/DisplayInfo>
#include "EventHandler.h"
@@ -71,6 +72,12 @@ int NativeWindowObject::setOrientationModes(TiObject* obj) {
return NATIVE_ERROR_OK;
}
+int NativeWindowObject::setTitle(TiObject* obj) {
+ QString title(*String::Utf8Value(obj->getValue()));
+ scene_.titleBar()->setTitle(title);
+ return NATIVE_ERROR_OK;
+}
+
void NativeWindowObject::open()
{
SceneManager::instance()->presentScene(&scene_);
View
1  src/tibb/NativeWindowObject.h
@@ -24,6 +24,7 @@ class NativeWindowObject : public NativeControlObject {
virtual void updateLayout(QRectF rect);
virtual int setOrientationModes(TiObject* obj);
+ virtual int setTitle(TiObject* obj);
void open();
void close();
View
10 src/tibb/PageScene.cpp
@@ -26,5 +26,15 @@ void PageScene::addAction(ActionItem* item) {
static_cast<Page*>(pane())->addAction(item, ActionBarPlacement::OnBar);
}
+TitleBar* PageScene::titleBar() {
+ Page* page = static_cast<Page*>(pane());
+ TitleBar* titleBar = page->titleBar();
+ if (!titleBar) {
+ titleBar = new TitleBar();
+ page->setTitleBar(titleBar);
+ }
+ return titleBar;
+}
+
} // namespace titanium
View
6 src/tibb/PageScene.h
@@ -8,6 +8,8 @@
#ifndef TI_PAGE_SCENE_H
#define TI_PAGE_SCENE_H
+#include <bb/cascades/TitleBar>
+
#include "Scene.h"
namespace titanium {
@@ -27,6 +29,10 @@ class PageScene : public Scene {
void addAction(bb::cascades::ActionItem* item);
+ // Returns the title bar for the page of this scene.
+ // If the page has no title bar one will be created.
+ bb::cascades::TitleBar* titleBar();
+
private:
Window* window_;
};
Please sign in to comment.
Something went wrong with that request. Please try again.