/* * IntroInit: Display logo. */ void IntroInit(void) { RECT rect; // Load logo if (!GetBitmapResourceInfo(hInst, IDB_LOGO, &logo)) { IntroShowSplash(); return; } /* Create bitmap for copying to screen */ hTitleDC = CreateMemBitmap(logo.width, logo.height, &hOldTitleBitmap, &gTitleBits); if (hTitleDC == NULL) { debug(("IntroInit couldn't create bitmap!\n")); IntroShowSplash(); return; } bm_width = logo.width; bm_height = logo.height; /* Simulate resize to get positions right */ GetClientRect(cinfo->hMain, &rect); EventResize(rect.right, rect.bottom, NULL); // Fade light level in light_level = 0; // Display logo for a certain amount of time timer_id = SetTimer(NULL, 0, LOGO_FADE_DELAY, LightTimerProc); }
/* * IntroShowSplash: Display splash screen. */ void IntroShowSplash(void) { RECT rect; BYTE *gTitleBits; int i; Bitmaps b; PDIB pdib; if (cinfo->config->quickstart) { OfflineConnect(); return; } if (showing_splash) return; showing_splash = True; IntroFreeLogo(); hwndDialButton = CreateWindow("button", NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, cinfo->hMain, (HMENU) IDC_DIALBUTTON, hInst, NULL); SetWindowText(hwndDialButton, GetString(hInst, IDS_INTRO)); /* Subclass button */ lpfnDefButtonProc = SubclassWindow(hwndDialButton, MainButtonProc); /* Get bits of bitmap from bgf file */ if (DibOpenFile(splash_filename, &b)) { pdib = BitmapsGetPdibByIndex(b, 0); /* Get bitmap's size */ bm_width = DibWidth(pdib); bm_height = DibHeight(pdib); /* Create bitmap */ hTitleDC = CreateMemBitmap(bm_width, bm_height, &hOldTitleBitmap, &gTitleBits); if (hTitleDC == NULL) { debug(("IntroShowSplash couldn't create bitmap!\n")); BitmapsFree(&b); return; } /* Copy bits into bitmap */ for (i=0; i < bm_height; i++) memcpy(gTitleBits + i * DIBWIDTH(bm_width), DibPtr(pdib) + i * bm_width, bm_width); BitmapsFree(&b); } else { hTitleDC = NULL; bm_width = BUTTON_XSIZE; } button_width = bm_width; button_height = BUTTON_YSIZE; /* Simulate resize to get positions right */ GetClientRect(cinfo->hMain, &rect); EventResize(rect.right, rect.bottom, NULL); SetFocus(hwndDialButton); timer_id = SetTimer(NULL, 0, MUSIC_DELAY, PlayMusicProc); }
bool CCWidget::Event(CCEvent* pEvent){ if(m_bVisible==false) return false; sRect r = GetRect(); r.x = r.y = 0; if(pEvent->iMessage==CCWM_LBUTTONDOWN) int k=0; CCEvent LocalEvent; MakeLocalEvent(&LocalEvent, pEvent); if(m_iDebugType==2){ if(pEvent->iMessage==CCWM_LBUTTONDOWN ) int k=0; } if(r.InPoint(LocalEvent.sPos)==true && (CCWidget::m_pCapturedWidget==NULL || CCWidget::m_pCapturedWidget==this) && IsVisible()==true){ if(m_pCursor!=NULL) CCCursorSystem::Set(m_pCursor); else CCCursorSystem::Set(CCCURSOR_ARROW); if(m_pToolTip!=NULL){ SetZOrder(CC_TOP); m_pToolTip->Show(true); } } else{ if(m_pToolTip!=NULL){ m_pToolTip->Show(false); } } if(m_bEnable==false) return false; if(GetLatestExclusive()!=NULL){ if(GetLatestExclusive()->Event(pEvent)==true) return true; if(GetLatestExclusive()!=NULL) return false; } if(pEvent->iMessage==CCWM_LBUTTONDOWN){ if ( r.InPoint(LocalEvent.sPos)==true){ SetFocus(); if((m_bFocusEnable)&&(m_bZOrderChangable==true)) SetZOrder(CC_TOP); } else // ReleaseFocus { // ReleaseFocus(); // OnReleaseFocus(); // ReleaseCapture(); } } if(GetLatestExclusive()==NULL){ for(int i=m_Children.GetCount()-1; i>=0; i--){ CCWidget* pCurWnd = m_Children.Get(i); if(pCurWnd->Event(pEvent)==true) { return true; } } } if(EventResize(pEvent)==true) return true; if(pEvent->iMessage==CCWM_HOTKEY){ if(OnHotKey(pEvent->uKey)==true) return true; } if(pEvent->iMessage==CCWM_CHAR || pEvent->iMessage==CCWM_KEYDOWN || pEvent->iMessage==CCWM_IMECOMPOSE || pEvent->iMessage==CCWM_ACTIONKEYDOWN || pEvent->iMessage==CCWM_ACTIONKEYUP || pEvent->iMessage==CCWM_ACTIONPRESSED || pEvent->iMessage==CCWM_ACTIONRELEASED){ if (IsFocus()) { if(OnEvent(&LocalEvent, GetListener())==true) return true; // Tab Key if(pEvent->iMessage==CCWM_KEYDOWN && pEvent->uKey==VK_TAB){ if(OnTab(!pEvent->GetShiftState())==true) return true; } } } else{ if((CCWidget::m_pCapturedWidget==NULL || CCWidget::m_pCapturedWidget==this)) if(OnEvent(&LocalEvent, GetListener())==true) return true; } if(pEvent->iMessage==CCWM_LBUTTONUP) ReleaseCapture(); return false; }