Apycom jQuery Menus

SDK Manila Sense Win32 Documentation

1.5

Introduction

I have created a win32 SDK that mimics HTC's Sense UI Look 'n Feel... More informations on my website: charlie-soft.com

This SDK is designed for speed: .NET applications are usually very slow to load and not fluid. I use some tricks to improve speed, like drawing only area having changes, scrolling without backbuffer or creating textures for text (GDI text drawing was slower…).
What’s in the box:

  • PNG resources for VGA/WVGA. They can be easily modified. SDK will resize automatically the resources if your device has a smaller (or higher) resolution!
  • Design your app for VGA, the SDK will adjust the layout for other resolutions!
  • Full Finger Control.
  • Source files (.cpp and .h) of library.
  • Source files of example.

Class:
  • MyEditControl: Edit box with different width. Easy get and set text. SIP detection: scroll Edit area.
  • MyItem: Button (3 types), checkboxes and switch (TripleState!). Event on click, visibility and state can be changed/get easily.
  • MyPanel : This element is not visible but is used to bring together elements. This element can have a title and dotted separator between each element.
  • ChildSection : Contains a subsection which is displayed with a sliding effect.
  • MyLabel: Print text with different font and color.
  • MyPictureBox: To print image (png, jpg, bmp, gif…)
  • MySelector: Like the HTML select. Scroll screen if list is out of screen (see video below).
  • Section: A section is a panel which can be scrolled up/down. It contains the different elements.
  • MessageBoxSense: Four type of messagebox: info, Ok/Cancel, Abort/Retry and Yes/No.
  • MySlider: A simple slider of any size... The min and max values can be changed easily, as the cursor position.
Change log
V1.5.1
  • Minor bug changes:
    • items out of screen no longer try to redraw
    • text of items recompute their size when changing
    • background color is correctly changed
V1.5
  • The SDK is now multi thread safe!
  • Add the possibility to right clicks (long press)
  • Add the possibility to hook windows message (WM_ACTIVATE for example)
  • Add the possibility to have a bottom bar.
  • Add the possibility to have a background image (landscape and portrait).
  • If the app is allready started, close the new instance and show the previous one.
  • MySelector can be scrolled if the list is too long.
  • Text is now printed with alpha transparency.
  • Compatible with any character (hebrew, vietnamese...).
  • MyPictureBox can now be stretched.
  • Memory usage reduced.
V1.4
  • Minor bugs fixed
  • Add the possibility to show MessageBox without a main application.
V1.3
  • Background can be transparent ! (see this app for demo)
  • Native drawing (DirectDraw was too slow in landscape)
  • Slider can have a force feedback (see this app for demo)
V1.2
  • MySlider added
  • drawing process rewrited: less redraw->less computation->less CPU utilization -> battery consumption reduced
  • Loading optimisation
  • The layout is now independent of screen resolution!
  • top taskbar is occassionally cleared [fixed]
  • White screen, touching the panel brings it back [fixed]
  • landscape items position incorrect [fixed]
V1.1
  • landscape compatible
  • Abort/Retry added to MessageBoxSense
  • TripleState Checkboxes and OnOffItems added

FAQ
  • is QVGA resolution supported?
    Yes, SDK will find the correct resolution and select the appropriate resource resolution. The SDK will delete the other resources...
  • have you planned to extend MessageBox types to Abort/Retry?
    Yes, to create one:
    MessageBoxSense::show(L"Hello",L"Try again ?", MESSAGE_ABORTRETRY);
  • is this landscape compatible?
    Yes but having refresh rate issue. Seems to be a DirectDraw problem (S2U2 was subject to the same issue...)
    If someone know how to solve this problem, send me a message !
  • Back button too slow.
    You can change the speed anim using this function: changeSpeed(double nbMilisecond)
  • why aren't you including some TripleState Checkboxes and OnOffItems ?
    Both are now included:
    new MyItem(1,5,15,ITEM_IS_CHECKBOX,ITEM_THIRD_STATE,L"My third checkbox (Third state)");


Other apps
Wake on Wan is a new app which use this SDK. Sources are available!
Quick shutdown is a software which use this SDK too. It can turn off, restart or set the phone in sleep mode. Sources are also available!

How create a new App ?

Set up environment


It is of course necessary to have the Windows Mobile SDK installed. You can download it using this link: SDK WM6.0. Then you can install the WM6.5 TDK (this is not a requirement) or the WM6.5.3 TDK.
Finally, you have to add the library to the project: put the .lib and .h in a directory (usually the project directory) and configures Visual Studio to use the .lib (project/properties/linker/input/Additional Dependencies).

Project creation


Create a new empty smartdevice project. In order to use the library, you have to put images into a directory named "resources" in the application directory and deploy it to the device. If it's not done, you will have this type of error at the start of your application: "Resource not available!"
Then create a new source file (.cpp) and create the WinMain function.
Add include to "SDK_Manila_Sense.h".

Application development


First, you have to create a class that inherits from "EventHandler". You have to implement the two followings methods:
void messageTreatment(Element* src,UINT msg);
void initApplication();

Your constructor should have a HINSTANCE parameter.

So, you will have something like that:

 class MyApp:
 public EventHandler
 {
 protected:
 //function to init application (add item to our window, init var, etc.)
 void initApplication();
 public:
 MyApp(HINSTANCE hInstance);
 ~MyApp(void);
 //function which is called when events appends
 void messageTreatment(Element* src,UINT msg);
 };

void initApplication();
This method should be used to init application (add item to our window -GlobalInformationswindow-, init var, etc.)

void messageTreatment(Element* src,UINT msg)
This method is called when event appends (clicks or value change). The parameter src is a pointer on the active Element and msg is equal to either EVENT_CLICK or EVENT_VALUE_CHANGED...

Back to WinMain


Once your class implemented, you just have to start your application:

 int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPWSTR lpCmdLine,int nCmdShow)
 {
 MyApp example(hInstance);//if MyApp is your class name...
 example.runApp();
 return 0;
 }

Application deployment

You have to put the resources in the same directory as your application and follow this tree:
yourApp
-resources
--VGA
---all PNG images needed by the SDK (if you don't use slider for example, the btn_common_slider.png is not needed)

Thibault LELORE