/**
 * Create a Canvas's native peer without showing yet.
 * Upon successful return, *canvasPtr will be filled properly.
 * Sound and abstract command buttons should not be handled in this
 * function. Separated function calls are used.
 *
 * @param canvasPtr pointer to MidpDisplayable structure to be filled in
 * @param title title string
 * @param tickerText ticker text
 * @param canvasType canvas type as defined in MidpComponentType
 * @return error code
 */
extern "C" MidpError
lfpport_canvas_create(MidpDisplayable* canvasPtr, const pcsl_string* title,
		      const pcsl_string* tickerText) {
  PlatformMScreen * mscreen = PlatformMScreen::getMScreen();

  /* Suppress unused-parameter warning */
  (void)tickerText;

    // Fill in MidpDisplayable structure
    canvasPtr->frame.widgetPtr	 = mscreen;
    canvasPtr->frame.show	 = canvas_show;
    canvasPtr->frame.hideAndDelete = canvas_hide_and_delete;
    canvasPtr->frame.handleEvent = canvas_handle_event;
    canvasPtr->setTitle		 = displayable_set_title;
    canvasPtr->setTicker	 = displayable_set_ticker;

    canvasPtr->setTitle(canvasPtr, title);
    /*canvasPtr->setTicker(canvasPtr, tickerText);*/

    // Give focus to mscreen so it can pass key/mouse events to Java
    mscreen->setFocus();

    // NOTE: if screen is in full mode different height will be set
    // later by MScreen::setFullScreenMode()
    mscreen->resizeContents(mscreen->getDisplayWidth(), 
                            mscreen->getScreenHeight());

    return KNI_OK;
}
/**
 * Set content of the container window.
 */
extern "C" MidpError
lfpport_form_set_content_size(MidpDisplayable* dispPtr, int w, int h) {

  QWidget *container = (QWidget *)((MidpFrame *)dispPtr)->widgetPtr;
  PlatformMScreen * mscreen = PlatformMScreen::getMScreen();

  if (h <= mscreen->getDisplayHeight()) {
    w = mscreen->getDisplayWidth();
    h = mscreen->getDisplayHeight(); 
  }

  container->resize(w, h);
  mscreen->resizeContents(w, h);

  return KNI_OK;
}