Skip to content

Commit

Permalink
Merge remote-tracking branch 'github_origin/master' into github_sandb…
Browse files Browse the repository at this point in the history
…ox_master
  • Loading branch information
Spiridon Alexandru committed Mar 20, 2012
2 parents 8bf3913 + 3a752e0 commit d941204
Show file tree
Hide file tree
Showing 116 changed files with 6,648 additions and 1,300 deletions.
2 changes: 1 addition & 1 deletion examples/cpp/MAUI/MAUIex/.mosyncproject
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project supports-build-configs="true" version="1.2">
<project supports-build-configs="true" version="1.4">
<build.cfg id="Debug" types="Debug"/>
<build.cfg id="Release" types="Release"/>
<properties>
Expand Down
28 changes: 23 additions & 5 deletions examples/cpp/NativeUIDemo/ScreenImageSwiper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,30 @@ void ScreenImageSwiper::createUI()
// Set the screen title.
setTitle(TXT_SCREEN_TITLE);

// Get the screen size.
getScreenSize();

if (getPlatform() == ANDROID)
{
// Set screen icon for Android.
setIcon(RES_TAB_ICON_IMAGE_SWIPER_ANDROID);

// Create ads banner.
if ( mScreenWidth > 50 )
{
if ( mScreenWidth > 60 )
{
mAdsBanner = new Ads::Banner(ADS_PUBLISHER_ID, Ads::BANNER_SIZE_LEADERBOARD);
}
else
{
mAdsBanner = new Ads::Banner(ADS_PUBLISHER_ID, Ads::BANNER_SIZE_IAB);
}
}
else
{
mAdsBanner = new Ads::Banner(ADS_PUBLISHER_ID);
}
}
else if(getPlatform() == IOS)
{
Expand All @@ -113,18 +133,16 @@ void ScreenImageSwiper::createUI()

// Set screen icon for iOS.
setIcon(RES_TAB_ICON_IMAGE_SWIPER);

// Create ads banner.
mAdsBanner = new Ads::Banner(ADS_PUBLISHER_ID);
}

// Create ads banner.
mAdsBanner = new Ads::Banner(ADS_PUBLISHER_ID);
mAdsBanner->requestContent(true);

// Add banner to layout.
mMainLayout->addBanner(mAdsBanner);

// Get the screen size.
getScreenSize();

// Create a RelativeLayout as container for images.
mImagesLayout = new RelativeLayout();

Expand Down
5 changes: 3 additions & 2 deletions examples/cpp/OpenGLES/AccelerometerOpenGLES/.mosyncproject
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
<criteria>
<filter mgr="0" profiles="" require="0" type="com.mobilesorcery.mosync.filters.profile" vendors="Android,BlackBerry,JavaME,Moblin,Symbian,Windows Mobile,Windows Phone,iOS"/>
<filter type="com.mobilesorcery.sdk.capabilities.devices.elementfactory">
<capabilities optional="" required="File\ Storage Internet\ Access OpenGL\ ES\ 2.0 OpenGL\ ES\ 1.0"/>
<capabilities optional="" required="Accelerometer OpenGL\ ES\ 2.0 OpenGL\ ES\ 1.0"/>
</filter>
</criteria>
<properties>
<property key="build.prefs:additional.libraries" value="MAUtil.lib"/>
<property key="build.prefs:additional.libraries/Debug" value="MAUtilD.lib"/>
<property key="build.prefs:app.permissions" value="Accelerometer Vibration"/>
<property key="profile.mgr.type" value="0"/>
<property key="template.id" value="project.moblet"/>
</properties>
</project>
</project>
53 changes: 39 additions & 14 deletions libs/MAStd/api_areas.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,6 @@ MAUtil::DataHandler
</td>
</tr>
<tr style="background-color: rgb(207, 226, 243);">
<td>
<strong>Permanent storage</strong>
</td>
<td>Store settings, values, downloaded data and programs.<br>
</td>
<td>maOpenStore(), maWriteStore(), maReadStore(), maCloseStore()<br>
</td>
<td><br>
</td>
<td><a href="#res" class="el">Resource management</a><br>
</td>
</tr>
<tr style="background-color: rgb(207, 226, 243);">
<td>
<strong>Graphics</strong>
Expand Down Expand Up @@ -275,6 +261,21 @@ MAUtil::DataHandler
<td><a href="#event" class="el">Event handling</a><br>
</td>
</tr>
<tr style="background-color: rgb(207, 226, 243);">
<td>
<strong>Permanent storage</strong>
</td>
<td>Store settings, values, downloaded data and programs.<br>
</td>
<td>maOpenStore(), maWriteStore(), maReadStore(), maCloseStore()<br>
</td>
<td><br>
</td>
<td><a href="#res" class="el">Resource management</a><br>
</td>
</tr>
<tr style="background-color: rgb(207, 226, 243);">
<td><strong>Filesystem</strong><br>
</td>
Expand All @@ -284,9 +285,33 @@ MAUtil::DataHandler
</td>
<td><br>
</td>
<td><a href="#res" class="el">Resource management</a><br>
</td>
</tr>
<tr style="background-color: rgb(207, 226, 243);">
<td>
<strong>Database API</strong>
</td>
<td>Functions for accessing SQLite databases. Note that maDBExecSQLParams() currently is available on iOS and MoRE (not on Android).<br>
</td>
<td>maDBOpen(),
maDBClose(),
maDBExecSQL(),
maDBExecSQLParams(),
maDBCursorDestroy(),
maDBCursorNext(),
maDBCursorGetColumnData(),
maDBCursorGetColumnText(),
maDBCursorGetColumnInt(),
maDBCursorGetColumnDouble()<br>
</td>
<td><br>
</td>
<td><a href="#res" class="el">Resource management</a><br>
</td>
</tr>
<tr style="background-color: rgb(207, 226, 243);">
<td><strong>Camera</strong><br>
</td>
Expand Down
4 changes: 3 additions & 1 deletion libs/MAStd/conprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@ void PrintConsole(const wchar_t *str)
#else
char* buf8 = (char*)malloc(length * MB_LEN_MAX);
#endif
int len8;
//maWriteLog(str, length*sizeof(wchar_t));
//convert to utf-8
int len8 = wcstombs(buf8, str, length * MB_LEN_MAX);
memset(buf8, 0, length * MB_LEN_MAX);
len8 = wcstombs(buf8, str, length * MB_LEN_MAX);
maWriteLog(buf8, len8);
if (str[length - 1] != '\n')
maWriteLog("\n", 1);
Expand Down
1 change: 1 addition & 0 deletions libs/NativeUI/Dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace NativeUI
*/
Dialog::~Dialog()
{
mDialogListeners.clear();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion libs/NativeUI/Layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace NativeUI
*/
void Layout::setScrollable(const bool isScrollable)
{
setProperty("isScrollable", (isScrollable ? "true" : "false") );
setProperty(MAW_VERTICAL_LAYOUT_SCROLLABLE, (isScrollable ? "true" : "false") );
}

/**
Expand Down
140 changes: 140 additions & 0 deletions libs/NativeUI/RadioButton.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
/*
Copyright (C) 2011 MoSync AB
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
*/

/**
* @file RadioButton.cpp
* @author Emma
*
* \brief An instance of RadioButton is used to create a two-states button that can
* be either checked or unchecked.
* A radio button can only have a RadioGroup parent.
* Checking one radio button that belongs to a radio group unchecks any previously
* checked radio button within the same group.
* Initially, all of the radio buttons are unchecked.
* While it is not possible to uncheck a particular radio button, the radio group
* can be cleared to remove the checked state.
* A radio button is available only on Android.
* For radio group events see RadioButtonListener.
*/

#include "RadioButton.h"
#include "RadioButtonListener.h"

namespace NativeUI
{
/**
* Constructor.
*/
RadioButton::RadioButton(): Widget(MAW_RADIO_BUTTON)
{
}

/**
* Destructor.
*/
RadioButton::~RadioButton()
{
mRadioButtonListeners.clear();
}

/**
* Change the checked state of the view to the inverse of its current state.
* If the radio button is already checked, this method will not toggle the radio button.
*/
void RadioButton::toggle()
{
setProperty(MAW_RADIO_BUTTON_TOGGLE, "");
}

/**
* Set the text to display.
* @param text The given text.
*/
void RadioButton::setText(const MAUtil::String text)
{
setProperty(MAW_RADIO_BUTTON_TEXT, text);
}

/**
* Get the displayed text.
* @return The displayed text.
*/
MAUtil::String RadioButton::getText()
{
return getPropertyString(MAW_RADIO_BUTTON_TEXT);
}

/**
* Specify the text color of the radio button.
* @param color A hexadecimal value 0xRRGGBB, where R, G and B are the
* red, green and blue components respectively.
*/
void RadioButton::setTextColor(int color)
{
char buffer[BUF_SIZE];
sprintf(buffer, "0x%.6X", color);
setProperty(MAW_RADIO_BUTTON_TEXT_COLOR, buffer);
}

/**
* Get the checked state of the radio button.
* @return true if the radio button is checked, false otherwise.
*/
bool RadioButton::isChecked()
{
MAUtil::String state = MAUtil::lowerString(getPropertyString(MAW_RADIO_BUTTON_CHECKED));
return ( strcmp( state.c_str(),"true") == 0 ? true : false );
}

/**
* Add a radio button event listener.
* @param listener The listener that will receive radio button events.
*/
void RadioButton::addRadioButtonListener(RadioButtonListener* listener)
{
addListenerToVector(mRadioButtonListeners, listener);
}

/**
* Remove the radio button event listener.
* @param listener The listener that receives radio button events.
*/
void RadioButton::removeRadioButtonListener(RadioButtonListener* listener)
{
removeListenerFromVector(mRadioButtonListeners, listener);
}

/**
* This method is called when there is an event for this widget.
* It passes on the event to all widget's listeners.
* @param widgetEventData The data for the widget event.
*/
void RadioButton::handleWidgetEvent(MAWidgetEventData* widgetEventData)
{
Widget::handleWidgetEvent(widgetEventData);

if ( MAW_EVENT_RADIO_BUTTON_STATE_CHANGED == widgetEventData->eventType )
{
for (int i=0; i < mRadioButtonListeners.size(); i++)
{
mRadioButtonListeners[i]->radioButtonStateChanged(this, widgetEventData->radioButtonState);
}
}
}

} // namespace NativeUI
Loading

0 comments on commit d941204

Please sign in to comment.