Exemple #1
0
static void nxtk_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
                           FAR const struct nxgl_point_s *pos,
                           FAR const struct nxgl_rect_s *bounds,
                           FAR void *arg)
{
  FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hwnd;
  struct nxgl_size_s subwindowsize;

  gvdbg("hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n",
        hwnd, size->w, size->h, pos->x, pos->y,
        bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y);

  /* Recalculate the dimensions of the toolbar and client windows */

  nxtk_setsubwindows(fwnd);

  /* Report the size / position of the client sub-window */

  if (fwnd->fwcb->position)
    {
      nxgl_rectsize(&subwindowsize, &fwnd->fwrect);
      fwnd->fwcb->position((NXTKWINDOW)fwnd, &subwindowsize,
                           &fwnd->fwrect.pt1, bounds, fwnd->fwarg);
    }

  /* Report the size / position of the toolbar sub-window */

  if (fwnd->tbcb && fwnd->tbcb->position)
    {
      nxgl_rectsize(&subwindowsize, &fwnd->tbrect);
      fwnd->tbcb->position((NXTKWINDOW)fwnd, &subwindowsize,
                           &fwnd->tbrect.pt1, bounds, fwnd->tbarg);
    }
}
Exemple #2
0
int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,
                     FAR const struct nx_callback_s *cb,
                     FAR void *arg)
{
  FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;

#ifdef CONFIG_DEBUG
  if (!hfwnd || !cb)
    {
      errno = EINVAL;
      return ERROR;
    }
#endif

  /* Initialize the toolbar info */

  fwnd->tbheight = height;
  fwnd->tbcb     = cb;
  fwnd->tbarg    = arg;

  /* Calculate the new dimensions of the toolbar and client windows */

  nxtk_setsubwindows(fwnd);

  /* Then redraw the entire window, even the client window must be
   * redraw because it has changed its vertical position and size.
   */

  nxfe_redrawreq(&fwnd->wnd, &fwnd->wnd.bounds);

  /* Return the initialized toolbar reference */

  return OK;
}
int nxtk_closetoolbar(NXTKWINDOW hfwnd)
{
  FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;

  /* Un-initialize the toolbar info */

  fwnd->tbheight = 0;
  fwnd->tbcb     = NULL;
  fwnd->tbarg    = NULL;

  /* Calculate the new dimensions of the client window */

  nxtk_setsubwindows(fwnd);

  /* Then redraw the entire window, even the client window must be
   * redraw because it has changed its vertical position and size.
   */

  nxfe_redrawreq(&fwnd->wnd, &fwnd->wnd.bounds);
  return OK;
}