/*
 * Function    : _libaroma_ctl_fragment_window_control_draw_begin
 * Return Value: LIBAROMA_CANVASP
 * Descriptions: get canvas for child control
 */
LIBAROMA_CANVASP _libaroma_ctl_fragment_window_control_draw_begin(
  LIBAROMA_WINDOWP win,LIBAROMA_CONTROLP cctl
){
  _VALIDATE_FRAGMENT(NULL);
  if (!wind->active_state){
    return NULL;
  }
  LIBAROMA_CANVASP c=NULL;
  libaroma_mutex_lock(me->dmutex);
  if (me->on_direct_canvas){
    int x = cctl->x;
    int y = cctl->y;
    int w = cctl->w;
    int h = cctl->h;
    LIBAROMA_CANVASP ccv = libaroma_control_draw_begin(ctl);
    if (ccv){
      if ((ccv->w>x)&&(ccv->h>y)){
        c = libaroma_canvas_area(ccv,x,y,w,h);
      }
      libaroma_canvas_free(ccv);
    }
  }
  else {
    if (win->dc!=NULL){
      c = libaroma_canvas_area(
        win->dc,
        cctl->x, cctl->y, cctl->w, cctl->h
      );
    }
  }
  libaroma_mutex_unlock(me->dmutex);
  return c;
} /* End of _libaroma_ctl_fragment_window_control_draw_begin */
/*
 * Function    : _libaroma_ctl_fragment_direct_canvas
 * Return Value: byte
 * Descriptions: set as direct canvas
 */
byte _libaroma_ctl_fragment_direct_canvas(LIBAROMA_CONTROLP ctl, byte state){
  _LIBAROMA_CTL_CHECK(
    _libaroma_ctl_fragment_handler, _LIBAROMA_CTL_FRAGMENTP, 0
  );
  libaroma_mutex_lock(me->dmutex);
  if ((me->win_n<1)||(me->win_pos==-1)) {
    libaroma_mutex_unlock(me->dmutex);
    return 0;
  }
  LIBAROMA_WINDOWP win = me->wins[me->win_pos];
  if (state){
    me->on_direct_canvas=1;
  }
  else{
    if (me->on_direct_canvas){
      LIBAROMA_CANVASP ccv = libaroma_control_draw_begin(ctl);
      if (ccv) {
        libaroma_draw(win->dc,ccv,0,0,0);
        libaroma_canvas_free(ccv);
      }
    }
    me->on_direct_canvas=0;
  }
  libaroma_mutex_unlock(me->dmutex);
  return 1;
} /* End of _libaroma_ctl_fragment_direct_canvas */
示例#3
0
/*
 * Function    : _libaroma_ctl_pager_direct_canvas
 * Return Value: byte
 * Descriptions: set as direct canvas
 */
byte _libaroma_ctl_pager_direct_canvas(LIBAROMA_CONTROLP ctl, byte state){
  _LIBAROMA_CTL_CHECK(
    _libaroma_ctl_pager_handler, _LIBAROMA_CTL_PAGERP, 0
  );
  //libaroma_mutex_lock(me->mutex);
  int xt = me->scroll_x; // me->page_position * ctl->w;
  if (state){
    if (!me->on_direct_canvas){
      me->on_direct_canvas=1;
    }
  }
  else{
    if (me->on_direct_canvas){
      LIBAROMA_CANVASP ccv = libaroma_control_draw_begin(ctl);
      if (ccv) {
        // libaroma_draw_ex(me->win->dc,ccv,0,0,xt,0,ccv->w,ccv->h,0,0xff);
        libaroma_draw_ex(me->win->dc,ccv,xt,0,0,0,ccv->w,ccv->h,0,0xff);
        libaroma_canvas_free(ccv);
      }
      me->on_direct_canvas=0;
    }
  }
  //libaroma_mutex_unlock(me->mutex);
  return 1;
} /* End of _libaroma_ctl_pager_direct_canvas */
示例#4
0
/*
 * Function    : libaroma_control_draw
 * Return Value: byte
 * Descriptions: draw control
 */
byte libaroma_control_draw(
  LIBAROMA_CONTROLP ctl, byte sync
){
  LIBAROMA_CANVASP c = libaroma_control_draw_begin(ctl);
  if (c!=NULL){
    if (ctl->handler->draw!=NULL){
      ctl->handler->draw(ctl,c);
    }
    libaroma_control_draw_end(ctl, c, sync);
    return 1;
  }
  return 0;
} /* End of libaroma_control_draw */
示例#5
0
/*
 * Function    : _libaroma_ctl_pager_window_control_draw_begin
 * Return Value: LIBAROMA_CANVASP
 * Descriptions: get canvas for child control
 */
LIBAROMA_CANVASP _libaroma_ctl_pager_window_control_draw_begin(
  LIBAROMA_WINDOWP win,LIBAROMA_CONTROLP cctl
){
  LIBAROMA_CONTROLP ctl=(LIBAROMA_CONTROLP) win->client_data;
  _LIBAROMA_CTL_CHECK(
    _libaroma_ctl_pager_handler, _LIBAROMA_CTL_PAGERP, NULL
  );
  LIBAROMA_CANVASP c=NULL;
  libaroma_mutex_lock(me->mutex);
  if (!me->on_direct_canvas){
    if (win->dc==NULL){
      libaroma_mutex_unlock(me->mutex);
      return NULL;
    }
    c = libaroma_canvas_area(
      win->dc,
      cctl->x, cctl->y, cctl->w, cctl->h
    );
  }
  else{
    int xt = me->scroll_x;
    int x = cctl->x - xt;
    int y = cctl->y;
    int w = cctl->w;
    int h = cctl->h;
    LIBAROMA_CANVASP ccv = libaroma_control_draw_begin(ctl);
    if (ccv){
      if ((ccv->w>x)&&(ccv->h>y)){
        c = libaroma_canvas_area(
          ccv,x,y,w,h
        );
      }
      libaroma_canvas_free(ccv);
    }
    else{
      libaroma_mutex_unlock(me->mutex);
      return NULL;
    }
  }
  libaroma_mutex_unlock(me->mutex);
  return c;
} /* End of _libaroma_ctl_pager_window_control_draw_begin */