示例#1
0
文件: window.cpp 项目: drodin/Crimson
void Window::Draw( void ) {
  DrawBack();

  Widget *wd = widgets;
  while ( wd ) {
    if ( !wd->Hidden() ) wd->Draw();
    wd = wd->next;
  }
}
示例#2
0
文件: window.cpp 项目: drodin/Crimson
GUI_Status Window::HandleEvent( const SDL_Event &event ) {

  if ( ((flags & WIN_CLOSE_ESC) && (event.type == SDL_KEYDOWN) &&
        (event.key.keysym.sym == SDLK_ESCAPE)) ||
       ((flags & WIN_CLOSE_UNFOCUS) && (event.type == SDL_MOUSEBUTTONDOWN) &&
        !Contains( event.button.x, event.button.y )) ) return GUI_CLOSE;

  GUI_Status rc = GUI_OK;
  Widget *wd = widgets;
  while ( wd ) {
    if ( !wd->Hidden() && !wd->Disabled() ) {
      GUI_Status wrc = wd->HandleEvent( event );
      if ( wrc != GUI_OK ) rc = wrc;
    }
    wd = wd->next;
  }

  return rc;
}