Skip to content

Commit

Permalink
Trunk, MAUI, updated MAUIex and some Widgets to conform to that they …
Browse files Browse the repository at this point in the history
…always have a default skin. Also optimizede the WidgetSkin a lot by introducing caching. Must test it a lot. But at least it's a lot faster now. Must add support to choose the size of the cache.

git-svn-id: svn://localhost/public/MoSync/trunk@887 6ad7a17e-d552-4a1e-ace4-f958fe14b117
  • Loading branch information
nummelin committed Mar 16, 2010
1 parent 812ca61 commit 015ab4e
Show file tree
Hide file tree
Showing 15 changed files with 359 additions and 6 deletions.
3 changes: 3 additions & 0 deletions examples/MAUI/MAUIex/.mosyncproject
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<property key="build.prefs:extra.res.sw" value=""/>
<property key="build.prefs:gcc.warnings/Debug" value="0"/>
<property key="build.prefs:gcc.warnings/Release" value="0"/>
<property key="build.prefs:memory.data/Release" value="256"/>
<property key="build.prefs:memory.heap/Release" value="250"/>
<property key="build.prefs:memory.stack/Release" value="2"/>
<property key="build.prefs:project.type" value=""/>
<property key="dependency.strategy" value="0"/>
<property key="last.build.config" value="Debug"/>
Expand Down
4 changes: 4 additions & 0 deletions examples/MAUI/MAUIex/Clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ namespace MAUI {
font(0)
{
setTimeType(LOCAL);
setDrawBackground(false);

//MAUtil::Environment::getEnvironment().addTimer(this, 1000, -1);
//requestRepaint();
}
Expand All @@ -54,6 +56,8 @@ namespace MAUI {
font(font)
{
setTimeType(LOCAL);
setDrawBackground(false);

//TODO: synchronize timer so it runs very soon after second-switch.
//MAUtil::Environment::getEnvironment().addTimer(this, 1000, -1);
//requestRepaint();
Expand Down
7 changes: 7 additions & 0 deletions examples/MAUI/MAUIex/ImageScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,19 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "MAHeaders.h"

ImageScreen::ImageScreen(Screen *previous) : previous(previous) {

mainLayout = new Layout(0, 0, scrWidth, scrHeight, NULL, 1, 2);
Widget *softKeys = createSoftKeyBar(30, "", "back");
Image *image = new Image(0, 0, scrWidth, scrHeight-softKeys->getHeight(), NULL, false, false, RES_IMAGE);
image->setSkin(gSkin);
image->setDrawBackground(true);
mainLayout->add(image);
mainLayout->add(softKeys);

mainLayout->setSkin(NULL);
mainLayout->setDrawBackground(true);
mainLayout->setBackgroundColor(0);

this->setMain(mainLayout);
}

Expand Down
1 change: 1 addition & 0 deletions examples/MAUI/MAUIex/LayoutScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ LayoutScreen::LayoutScreen(Screen *previous) : previous(previous) {
layout->setMarginY(5);
layout->setPaddingLeft(5);
layout->setPaddingRight(5);
layout->setDrawBackground(false);

for(int i = RES_ICONS_START; i != RES_ICONS_END+1; i++) {
new Image(0, 0, 0, 0, layout, true, true, i);
Expand Down
6 changes: 6 additions & 0 deletions examples/MAUI/MAUIex/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ Widget* createSoftKeyBar(int height, const char *left, const char *right) {

label = new Label(0,0, scrWidth/2, height, NULL, left, 0, gFont);
label->setHorizontalAlignment(Label::HA_LEFT);
label->setDrawBackground(false);
setLabelPadding(label);
layout->add(label);

label = new Label(0,0, scrWidth/2, height, NULL, right, 0, gFont);
label->setDrawBackground(false);
label->setHorizontalAlignment(Label::HA_RIGHT);
setLabelPadding(label);
layout->add(label);
Expand All @@ -71,5 +73,9 @@ Layout* createMainLayout(const char *left, const char *right) {

mainLayout->add(softKeys);

mainLayout->setSkin(NULL);
mainLayout->setDrawBackground(true);
mainLayout->setBackgroundColor(0);

return mainLayout;
}
1 change: 1 addition & 0 deletions libs/MAUI/EditBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace MAUI {
* use it (when using the default behaviour it is then added as a keylistener to the system
* and responds to all keypresses until it is deselected. Be sure to implement this behaviour
* using a widgetlistener and the activate/deactivate functions if you are making a custom behaviour).
* See Label for more information.
**/
class EditBox :
// public Widget, CharInputListener, KeyListener {
Expand Down
1 change: 1 addition & 0 deletions libs/MAUI/Image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace MAUI {
autoSizeX(autoSizeX),
autoSizeY(autoSizeY)
{
setDrawBackground(false);
setResource(res);

}
Expand Down
1 change: 1 addition & 0 deletions libs/MAUI/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace MAUI {
* Image is a widget used to put plain images in a graphical user
* interface. Pass the resource handle to the widget and it will display
* that image.
* The widget doesn't draw its background by default, use setDrawBackground(true) to enable it.
*/
class Image : public Widget {
public:
Expand Down
1 change: 1 addition & 0 deletions libs/MAUI/Label.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ namespace MAUI {
/** A label widget is a simple widget capable of displaying
*text. The text can be aligned left, right or centered
* both vertically and horizontally.
* The widget draws its background by default, use setDrawBackground(false) to disable it.
**/

class Label : public Widget {
Expand Down
2 changes: 2 additions & 0 deletions libs/MAUI/Layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace MAUI {
gridXSize(gridXSize),
gridYSize(gridYSize),
selectedIndex(0) {
setDrawBackground(false);
requestRepaint();
}

Expand All @@ -49,6 +50,7 @@ namespace MAUI {
gridYSize(gridYSize),
selectedIndex(0)
{
setDrawBackground(false);
requestRepaint();
}

Expand Down
1 change: 1 addition & 0 deletions libs/MAUI/Layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace MAUI {

/** This widget is responsible for laying out its children in a grid. It also provides
* navigation facilites within that grid, so that the children can be selected and triggered.
* The widget doesn't draw its background by default, use setDrawBackground(true) to enable it.
**/

class Layout : public Widget, WidgetListener {
Expand Down
1 change: 1 addition & 0 deletions libs/MAUI/ListBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ namespace MAUI {
* followed by another, nested ListBox. Furthermore, the navigation is decoupled from input. For instance, it
* provides functions such as selectNextItem() rather than assuming that the way of doing this should always
* be done by pressing the "down" key.
* The widget draws its background by default, use setDrawBackground(false) to disable it.
**/
class ListBox : public Widget, MAUtil::TimerListener, WidgetListener {
public:
Expand Down
Loading

0 comments on commit 015ab4e

Please sign in to comment.