summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-02-03 22:02:01 +0100
committerMichael Meeks <michael.meeks@suse.com>2012-02-03 22:02:01 +0100
commit5cd1d6740cc9e85b5ed3730800dff4717cb7e1ae (patch)
tree6ab295348f9828b4086c1e3df98f7077a2b39a8d
parent5d933f259d7cdc9d600d921d51ef9d4187dbd701 (diff)
android: implement theming to get default font set, 1st cut at GetWorkArea
-rw-r--r--vcl/android/androidinst.cxx72
-rw-r--r--vcl/inc/android/androidinst.hxx6
2 files changed, 78 insertions, 0 deletions
diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index ec38cec9792a..16a512551c33 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -347,6 +347,18 @@ static const char *app_cmd_name(int cmd)
}
}
+void AndroidSalInstance::GetWorkArea( Rectangle& rRect )
+{
+ ANativeWindow *pWindow = mpApp->window;
+ if (!pWindow)
+ rRect = Rectangle( Point( 0, 0 ),
+ Size( 800, 600 ) );
+ else
+ rRect = Rectangle( Point( 0, 0 ),
+ Size( ANativeWindow_getWidth( pWindow ),
+ ANativeWindow_getHeight( pWindow ) ) );
+}
+
void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd)
{
fprintf (stderr, "app cmd for app %p: %s\n", app, app_cmd_name(cmd));
@@ -603,6 +615,66 @@ SalSystem *AndroidSalInstance::CreateSalSystem()
return new AndroidSalSystem();
}
+class AndroidSalFrame : public SvpSalFrame
+{
+public:
+ AndroidSalFrame( AndroidSalInstance *pInstance,
+ SalFrame *pParent,
+ sal_uLong nSalFrameStyle,
+ SystemParentData *pSysParent )
+ : SvpSalFrame( pInstance, pParent, nSalFrameStyle, pSysParent )
+ {
+ }
+
+ virtual void GetWorkArea( Rectangle& rRect )
+ {
+ AndroidSalInstance::getInstance()->GetWorkArea( rRect );
+ }
+
+ virtual void UpdateSettings( AllSettings &rSettings )
+ {
+ // Clobber the UI fonts
+#if 0
+ psp::FastPrintFontInfo aInfo;
+ aInfo.m_aFamilyName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Roboto" ) );
+ aInfo.m_eItalic = ITALIC_NORMAL;
+ aInfo.m_eWeight = WEIGHT_NORMAL;
+ aInfo.m_eWidth = WIDTH_NORMAL;
+ psp::PrintFontManager::get().matchFont( aInfo, rSettings.GetUILocale() );
+#endif
+
+ // FIXME: is 12 point enough ?
+ Font aFont( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Roboto" ) ),
+ Size( 0, 14 ) );
+
+ StyleSettings aStyleSet = rSettings.GetStyleSettings();
+ aStyleSet.SetAppFont( aFont );
+ aStyleSet.SetHelpFont( aFont );
+ aStyleSet.SetMenuFont( aFont );
+ aStyleSet.SetToolFont( aFont );
+ aStyleSet.SetLabelFont( aFont );
+ aStyleSet.SetInfoFont( aFont );
+ aStyleSet.SetRadioCheckFont( aFont );
+ aStyleSet.SetPushButtonFont( aFont );
+ aStyleSet.SetFieldFont( aFont );
+ aStyleSet.SetIconFont( aFont );
+ aStyleSet.SetGroupFont( aFont );
+
+ rSettings.SetStyleSettings( aStyleSet );
+ }
+};
+
+SalFrame *AndroidSalInstance::CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle )
+{
+ return new AndroidSalFrame( this, NULL, nStyle, pParent );
+}
+
+SalFrame *AndroidSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nStyle )
+{
+ return new AndroidSalFrame( this, pParent, nStyle, NULL );
+}
+
+
// All the interesting stuff is slaved from the AndroidSalInstance
void InitSalData() {}
void DeInitSalData() {}
diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx
index e947737a68ae..10d17c53b8b5 100644
--- a/vcl/inc/android/androidinst.hxx
+++ b/vcl/inc/android/androidinst.hxx
@@ -49,6 +49,11 @@ public:
virtual SalSystem* CreateSalSystem();
+ // frame management
+ void GetWorkArea( Rectangle& rRect );
+ SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle );
+ SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle );
+
// mainloop pieces
virtual void Wakeup();
virtual bool AnyInput( sal_uInt16 nType );
@@ -58,6 +63,7 @@ public:
int32_t onInputEvent (struct android_app* app, AInputEvent* event);
void RedrawWindows(ANativeWindow *pWindow);
SalFrame *getFocusFrame() const;
+
protected:
virtual void DoReleaseYield( int nTimeoutMS );
struct android_app *mpApp;