void APP_Initialize ( void ) { demoScheme = GFX_GOL_SchemeCreate(); // create alternative style scheme AlphaScheme = GFX_GOL_SchemeCreate(); // create alternative style scheme demoScheme->TextColor0 = BLUE; demoScheme->TextColor1 = RED; demoScheme->pFont = (void*)&Gentium_16; demoScheme->fillStyle = GFX_FILL_STYLE_COLOR; AlphaScheme->Color0 = GFX_RGBConvert(0x4C, 0x8E, 0xFF); AlphaScheme->Color1 = GFX_RGBConvert(255, 102, 0); AlphaScheme->EmbossDkColor = GFX_RGBConvert(0x1E, 0x00, 0xE5); AlphaScheme->EmbossLtColor = GFX_RGBConvert(0xA9, 0xDB, 0xEF); AlphaScheme->ColorDisabled = GFX_RGBConvert(0xD4, 0xE1, 0xF7); AlphaScheme->TextColor1 = BLUE; AlphaScheme->TextColor0 = GFX_RGBConvert(255, 102, 0); AlphaScheme->TextColorDisabled = GFX_RGBConvert(0xB8, 0xB9, 0xBC); AlphaScheme->AlphaValue = 50; AlphaScheme->pFont = (void*)&Gentium_16; AlphaScheme->fillStyle = GFX_FILL_STYLE_COLOR; SYS_TMR_DelayMS(5000); GFX_GOL_MessageCallbackSet(&GFX_GOL_MessageCallback); GFX_GOL_DrawCallbackSet(&GFX_GOL_DrawCallback); CreateMainMenu(); }
/** * Constructor * * @param frame Parent frame * @param title Title for the frame * @param x window position x * @param y window position y * @param w window width * @param h window height * @param mode window mode ("Permanent", "Temporary") * @param type text type ("Output", "Script") */ ViewTextFrame::ViewTextFrame(wxFrame *frame, const wxString& title, int x, int y, int w, int h, const wxString &mode, const wxString &type) : wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h), wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT) { CreateStatusBar(2); mWindowMode = mode; mTextType = type; // Set additional style wxTE_RICH to Ctrl + mouse scroll wheel to decrease or // increase text size(loj: 2009.02.05) mTextCtrl = new wxTextCtrl(this, -1, _T(""), wxPoint(0, 0), wxSize(0, 0), wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP | wxTE_RICH); mTextCtrl->SetMaxLength(320000); mTextCtrl->SetFont(GmatAppData::Instance()->GetFont()); #if wxUSE_MENUS // create a menu bar SetMenuBar(CreateMainMenu()); #endif // wxUSE_MENUS // Set icon if icon file is in the start up file FileManager *fm = FileManager::Instance(); try { wxString iconfile = fm->GetFullPathname("MAIN_ICON_FILE").c_str(); #if defined __WXMSW__ SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_ICO)); #elif defined __WXGTK__ SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_XPM)); #elif defined __WXMAC__ SetIcon(wxIcon(iconfile, wxBITMAP_TYPE_PICT_RESOURCE)); #endif } catch (GmatBaseException &) { //MessageInterface::ShowMessage(e.GetMessage()); } CenterOnScreen(wxBOTH); }
// this function returns zero. ///////////////////////////////////////////////////////////////////////////// bool GFX_GOL_DrawCallback(void) { switch(screenState) { case CREATE_MAINMENU: GFX_GOL_ObjectListFree(); GFX_ColorSet(WHITE); while(GFX_ScreenClear() == GFX_STATUS_FAILURE); CreateMainMenu(); screenState = DISPLAY_MAINMENU; // switch to next state break; case DISPLAY_MAINMENU: break; case CREATE_ALPHABLEND: GFX_GOL_ObjectListFree(); CreateAlphaBlendScreen(); CreateBackButton(); screenState = DISPLAY_ALPHABLEND; // switch to next state break; case DISPLAY_ALPHABLEND: break; default: break; } return (1); }
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow) { MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon(NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = MAKEINTRESOURCE(IDR_MYMENU); /* menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default colour as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; InitCommonControls(); /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "jsObfsc v1 - a simple javascript code minifier+obfuscator", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ WINW, /* The programs width */ WINH, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow (hwnd, nCmdShow); // Create the main menu CreateMainMenu(); hinst = hThisInstance; DrawText(GetDC(hwnd), " ", 1, &hwrect, DT_CALCRECT); // obtain text size FontSize = hwrect.bottom-hwrect.top; // 16 GetClientRect(hwnd, &hwrect); CreateTabs(); CreaTexts(); // Set a timer. SetTimer(hwnd, // handle to main window IDT_TIMER1, // timer identifier 200, // 1/5 second interval (TIMERPROC) NULL); // no timer callback ClearDispNo(); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; }
void *CSimAppToolkit::SetupMenuPlugin(void) { return(CreateMainMenu((PU8)"PIXTEL SAT",mainMenu,4)); }
LRESULT CALLBACK FrameProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { case WM_HSCROLL:{ int xDelta; int xNewPos; int yDelta = 0; switch (LOWORD(wParam)) { /* User clicked the shaft left of the scroll box. */ case SB_PAGEUP: xNewPos = xCurrentScroll - xPageScroll; break; /* User clicked the shaft right of the scroll box. */ case SB_PAGEDOWN: xNewPos = xCurrentScroll + xPageScroll; break; /* User clicked the left arrow. */ case SB_LINEUP: xNewPos = xCurrentScroll - xIncrementScroll; break; /* User clicked the right arrow. */ case SB_LINEDOWN: xNewPos = xCurrentScroll + xIncrementScroll; break; /* User dragged or is dragging the scroll box. */ case SB_THUMBPOSITION: case SB_THUMBTRACK: xNewPos = HIWORD(wParam); break; default: xNewPos = xCurrentScroll; } /* New position must be between 0 and the screen width. */ xNewPos = max(0, xNewPos); xNewPos = min(xMaxScroll, xNewPos); /* If the current position does not change, do not scroll.*/ if (xNewPos == xCurrentScroll) break; /* Determine the amount scrolled (in pixels). */ xDelta = (xNewPos - xCurrentScroll)*xPixelsPerIncrement; //(-) is hit left, scroll right /* Reset the current scroll position. */ xCurrentScroll = xNewPos; ScrollDC(hdcMemoryTheMap,-xDelta,-yDelta,NULL,NULL,NULL,NULL); MapPositionX=xCurrentScroll; if (xDelta>0) //hit right, scroll left RenderScreen(hwnd,max(0,(TheMapWidth-xDelta)),0,TheMapWidth,TheMapHeight); else //hit left, scroll right RenderScreen(hwnd,0,0,min(TheMapWidth,-xDelta),TheMapHeight); ScrollWindowEx(hwnd, -xDelta, -yDelta, &TheWindowRect, &TheWindowRect, (HRGN) NULL, (LPRECT) NULL, SW_INVALIDATE); // InvalidateRect(hwnd,&TheWindowRect,false); UpdateWindow(hwnd); ResetScrollBarX(hwnd); } break; case WM_VSCROLL:{ int xDelta=0; int yNewPos; int yDelta; switch (LOWORD(wParam)) { /* User clicked the shaft above scroll box. */ case SB_PAGEUP: yNewPos = yCurrentScroll - yPageScroll; break; /* User clicked the shaft below the scroll box. */ case SB_PAGEDOWN: yNewPos = yCurrentScroll + yPageScroll; break; /* User clicked the up arrow. */ case SB_LINEUP: yNewPos = yCurrentScroll - yIncrementScroll; break; /* User clicked the down arrow. */ case SB_LINEDOWN: yNewPos = yCurrentScroll + yIncrementScroll; break; /* User dragged or is dragging the scroll box. */ case SB_THUMBPOSITION: case SB_THUMBTRACK: yNewPos = HIWORD(wParam); break; default: yNewPos = yCurrentScroll; } /* New position must be between 0 and the screen height. */ yNewPos = max(0, yNewPos); yNewPos = min(yMaxScroll, yNewPos); /* If the current position does not change, do not scroll.*/ if (yNewPos == yCurrentScroll) break; /* Determine the amount scrolled (in pixels). */ yDelta = (yNewPos - yCurrentScroll)*yPixelsPerIncrement; //(-) is hit up, scroll down /* Reset the current scroll position. */ yCurrentScroll = yNewPos; ScrollDC(hdcMemoryTheMap,-xDelta,-yDelta,NULL,NULL,NULL,NULL); MapPositionY=yCurrentScroll; if (yDelta>0) //hit down, scroll up RenderScreen(hwnd,0,max(0,(TheMapHeight-yDelta)),TheMapWidth,TheMapHeight); else //hit up, scroll down RenderScreen(hwnd,0,0,TheMapWidth,min(TheMapHeight,-yDelta)); ScrollWindowEx(hwnd, -xDelta, -yDelta, &TheWindowRect, &TheWindowRect, (HRGN) NULL, (LPRECT) NULL, SW_INVALIDATE); UpdateWindow(hwnd); ResetScrollBarY(hwnd); } break; case WM_COMMAND: MainWindowCommand(hwnd,LOWORD(wParam)); break; case WM_ERASEBKGND: if (MapLoaded) return 1; //don't erase background if we have the map loaded return DefWindowProc(hwnd, Message, wParam, lParam); case WM_PAINT: PAINTSTRUCT ps; HDC hdcWindow; hdcWindow = BeginPaint(hwnd, &ps); if (!TheMapBitmap) { CreateMainBitmapX(hwnd); RenderFullScreen(hwnd); } DisplayFullScreen2(hdcWindow); EndPaint(hwnd, &ps); break; case WM_SIZE: //Adjust our bitmap to fit window if ((wParam==SIZE_MAXIMIZED)||(wParam==SIZE_RESTORED)) AdjustScreenSize(hwnd,LOWORD(lParam),HIWORD(lParam)); break; case WM_CREATE: CreateMainMenu(hwnd); break; case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: FreeAllData(); if (hdcMemoryTheMap) DeleteDC(hdcMemoryTheMap); if (TheMapBitmap) DeleteObject(TheMapBitmap); PostQuitMessage(0); break; default: return DefWindowProc(hwnd, Message, wParam, lParam); } return 0; }
NewtonDemos::NewtonDemos(const wxString& title, const wxPoint& pos, const wxSize& size) :wxFrame(NULL, -1, title, pos, size) ,m_mainMenu(NULL) ,m_joystick(NULL) ,m_statusbar(NULL) ,m_scene(NULL) ,m_broadPhaseType(0) ,m_physicsUpdateMode(0) ,m_suspendVisualUpdates(true) ,m_autoSleepState(true) ,m_useParallelSolver(false) ,m_hideVisualMeshes(false) ,m_showContactPoints(false) ,m_showNormalForces(false) ,m_showAABB(false) ,m_showJoints(false) ,m_showCenterOfMass(false) ,m_showStatistics(false) ,m_concurrentProfilerState(false) ,m_threadProfilerState(false) ,m_hasJoysticController(false) ,m_shiftKey(false) ,m_controlKey(false) ,m_solverModeIndex(3) ,m_solverModeQuality(0) ,m_debugDisplayMode(0) ,m_mousePosX(0) ,m_mousePosY(0) ,m_joytickX(0) ,m_joytickY(0) ,m_joytickButtonMask(0) ,m_framesCount(0) ,m_microthreadIndex(0) ,m_hardwareDevice(0) ,m_timestepAcc(0) ,m_fps(0.0f) { /* //m_broadPhaseType = 1; //m_autoSleepState = false; //m_microthreadIndex = 1; //m_useParallelSolver = true; //m_threadProfilerState = true; m_showNormalForces = true; //m_showCenterOfMass = true; m_hideVisualMeshes = true; //m_physicsUpdateMode = 1; m_showContactPoints = true; //m_hardwareDevice = 2; //m_showStatistics = true; //*/ //m_debugDisplayMode = 2; //m_autoSleepState = false; //m_microthreadIndex = 1; //m_useParallelSolver = true; memset (m_profilerTracksMenu, 0, sizeof (m_profilerTracksMenu)); // clear the key map memset (m_key, 0, sizeof (m_key)); for (int i = 0; i < int (sizeof (m_keyMap)/sizeof (m_keyMap[0])); i ++) { m_keyMap[i] = i; } for (int i = 'a'; i <= 'z'; i ++) { m_keyMap[i] = i - 'a' + 'A'; } #ifdef WIN32 m_keyMap[0] = VK_LBUTTON; m_keyMap[1] = VK_RBUTTON; m_keyMap[2] = VK_MBUTTON; #endif m_scene = new DemoEntityManager(this); m_statusbar = CreateStatusBar(); //int widths[] = {150, 160, 150, 90, 80, 100, 100}; int widths[] = {-1, -1, -1, -1, -1, -1, -1}; m_statusbar->SetFieldsCount (sizeof (widths)/sizeof (widths[0]), widths); CalculateFPS(0.0f); m_mainMenu = CreateMainMenu(); /* wxJoystick stick(wxJOYSTICK1); if (!stick.IsOk()) { wxMessageBox(wxT("No joystick detected!")); return false; } #if wxUSE_SOUND m_fire.Create(wxT("buttonpress.wav")); #endif // wxUSE_SOUND m_minX = stick.GetXMin(); m_minY = stick.GetYMin(); m_maxX = stick.GetXMax(); m_maxY = stick.GetYMax(); */ // f*****g wxwidget require a f*****g library just to read a f*****g joystick f**k you WxWidget // m_joystick = new wxJoystick(wxJOYSTICK1); // m_joystick->SetCapture(this, 10); }
// main dialog constructor MusikFrame::MusikFrame() : wxFrame( (wxFrame*)NULL, -1, MUSIKAPPNAME_VERSION, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL | wxCLIP_CHILDREN ) { //--- pointer to main dialog, defined in MusikGlobals ---// g_MusikFrame = this; //--- prevent destroying saved placement info while constructing the frame ---// g_DisablePlacement = true; //--- icon ---// #ifdef __WXMSW__ SetIcon( wxICON( musicbox ) ); #endif #ifdef __WXGTK__ SetIcon( wxIcon(tray_xpm) ); #endif #ifdef wxHAS_TASK_BAR_ICON if(wxGetApp().Prefs.bDisableTrayIcon) m_pTaskBarIcon = NULL; else m_pTaskBarIcon = new MusikTaskBarIcon(this); #endif #ifdef __WXMAC__ MacSetMetalAppearance(true); #endif //--- colours ---// // this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ) ); //--- load image lists and fonts ---// LoadImageLists(); GetFonts(); //-------------------------// //--- initialize sizers ---// //-------------------------// m_pBottomPanel = new BottomPanel(this); m_pBottomPanel->SetDefaultSize(wxSize(1000,70)); m_pBottomPanel->SetAlignment(wxGetApp().Prefs.bShowNowPlayingControlOnTop == true ? wxLAYOUT_TOP : wxLAYOUT_BOTTOM); m_pBottomPanel->SetOrientation(wxLAYOUT_HORIZONTAL); //----------------// //--- playlist ---// //----------------// g_PlaylistBox = new CPlaylistBox( this ); GetListCtrlFont(); //---------------// //--- sources ---// //---------------// g_SourcesCtrl = new CSourcesBox( this ); g_SourcesCtrl->SetSashVisible(wxSASH_RIGHT, true); g_SourcesCtrl->SetDefaultSize(wxSize(wxGetApp().Prefs.nSourceBoxWidth,1000)); g_SourcesCtrl->SetAlignment(wxLAYOUT_LEFT); g_SourcesCtrl->SetOrientation(wxLAYOUT_VERTICAL); g_SourcesCtrl->SetSashBorder(wxSASH_RIGHT, true); g_SourcesCtrl->SetSashBorder(wxSASH_RIGHT, true); g_SourcesCtrl->SetDefaultBorderSize(3); g_SourcesCtrl->SetExtraBorderSize(1); //---------------------// //--- activity area ---// //---------------------// g_ActivityAreaCtrl = new CActivityAreaCtrl( this ); g_ActivityAreaCtrl->SetSashVisible(wxSASH_BOTTOM, true); g_ActivityAreaCtrl->SetDefaultSize(wxSize(1000,wxGetApp().Prefs.nActivityCtrlHeight)); g_ActivityAreaCtrl->SetAlignment(wxLAYOUT_TOP); g_ActivityAreaCtrl->SetOrientation(wxLAYOUT_HORIZONTAL); g_ActivityAreaCtrl->SetSashBorder(wxSASH_BOTTOM, true); g_ActivityAreaCtrl->SetDefaultBorderSize(3); g_ActivityAreaCtrl->SetExtraBorderSize(1); //--- taylor ui ---// ShowPlaylistInfo(); ShowSources(); ShowAlbumArt(); SetStayOnTop(( bool )wxGetApp().Prefs.bStayOnTop); CreateMainMenu(); //--- restore placement or use defaults ---// g_DisablePlacement = false; wxGetApp().Player.SetPlaymode(wxGetApp().Prefs.ePlaymode); //--- update database information, then set sound volume ---// wxGetApp().Player.SetVolume(); wxGetApp().Player.Connect(wxEVT_MUSIKPLAYER_SONG_CHANGED,MusikPlayerEventHandler(MusikFrame::OnSongChanged),NULL,this); wxGetApp().Player.Connect(wxEVT_MUSIKPLAYER_PLAY_STOP,MusikPlayerEventHandler(MusikFrame::OnPlayStop),NULL,this); SetTitle(); SetSongInfoText(MUSIKAPPNAME); SetActiveThread( NULL ); #ifdef __WXMSW__ SetMMShellHook((HWND)GetHWND()); #endif #ifdef __WXGTK__ XF86AudioKeyGrab_init(); #endif }