int main(int argc, char *argv[]) { if (!TXT_Init()) { fprintf(stderr, "Failed to initialise GUI\n"); exit(-1); } TXT_SetDesktopTitle("Calculator demo"); BuildGUI(); TXT_GUIMainLoop(); TXT_Shutdown(); return 0; }
GameTotalAllocationWidget::GameTotalAllocationWidget(): Gtk::VBox(), //Calls the base class constructor m_currentGameFinished(false), m_theTotalAllocationGame( GameTotalAllocationConfig::Instance().GetNRows(), GameTotalAllocationConfig::Instance().GetNColumns(), GameTotalAllocationConfig::Instance().GetStartingCoord()), m_pickPiecesDrawingArea( m_theTotalAllocationGame.GetPlayer(), DrawingAreaShowPieces::eOrientation_leftToRight), m_boardDrawingArea(m_theTotalAllocationGame.GetBoard()), m_editPieceTable(), m_statusBar(1, false) // 1 player. Without progress bar { // build up the GUI! BuildGUI(); // connect the signal coming fromt the board drawing area to process when // the user clicks on the board m_boardDrawingArea.signal_boardPicked().connect( sigc::mem_fun(*this, &GameTotalAllocationWidget::BoardDrawingArea_BoardClicked)); // initialise the list of players of the board drawing area m_boardDrawingArea.AddPlayerToList(m_theTotalAllocationGame.GetPlayer()); // player is a human and he/she will put down a piece m_boardDrawingArea.SetCurrentPlayer(m_theTotalAllocationGame.GetPlayer()); // set piece colour to player's in the edit piece area uint8_t red = 0; uint8_t green = 0; uint8_t blue = 0; m_theTotalAllocationGame.GetPlayer().GetColour(red, green, blue); m_editPieceTable.SetPieceRGB( static_cast<float>(red) / 255, static_cast<float>(green) / 255, static_cast<float>(blue) / 255); // human beings are allowed to edit pieces m_editPieceTable.set_sensitive(true); // launch the game!! LaunchNewGame(); }
GameChallengeWidget::GameChallengeWidget(const BlockemChallenge& a_challenge): Gtk::VBox(), //Calls the base class constructor m_currentGameFinished(false), m_theChallengeGame(a_challenge), // a default dummy challenge m_pickPiecesDrawingArea( m_theChallengeGame.GetChallenger(), DrawingAreaShowPieces::eOrientation_leftToRight), m_boardDrawingArea(m_theChallengeGame.GetBoard()), m_editPieceTable(), m_statusBar(1, false) // 1 player (only the challenger). Without progress bar { // build up the GUI! BuildGUI(); // connect the signal coming fromt the board drawing area to process when // the user clicks on the board m_boardDrawingArea.signal_boardPicked().connect( sigc::mem_fun(*this, &GameChallengeWidget::BoardDrawingArea_BoardClicked)); // initialise the list of players of the board drawing area m_boardDrawingArea.AddPlayerToList(m_theChallengeGame.GetChallenger()); // player is a human and he/she will put down a piece m_boardDrawingArea.SetCurrentPlayer(m_theChallengeGame.GetChallenger()); // set piece colour to player's in the edit piece area uint8_t red = 0; uint8_t green = 0; uint8_t blue = 0; m_theChallengeGame.GetChallenger().GetColour(red, green, blue); m_editPieceTable.SetPieceRGB( static_cast<float>(red) / 255, static_cast<float>(green) / 255, static_cast<float>(blue) / 255); // human beings are allowed to edit pieces m_editPieceTable.set_sensitive(true); // No need to launch the new game since it will be always // launched with a brand new challenge //LaunchNewGame(); }
/* main procedure */ int main (int argc, char **argv) { int IsFather; int i; /* we get rid of the path from program name */ ModuleName = argv[0]; /* On determine si le script a un pere */ if (argc>=8) IsFather=(argv[7][0]!=(char)161); else IsFather=1; signal (SIGPIPE, DeadPipe); signal (SIGINT, DeadPipe); /* cleanup on other ways of closing too */ signal (SIGHUP, DeadPipe); signal (SIGQUIT, DeadPipe); signal (SIGTERM, DeadPipe); if (argc < 6) { fprintf(stderr,"%s must be started by Fvwm.\n", ModuleName); exit(1); } else if(argc>=7) { ScriptName = argv[6]; ref = strtol(argv[4], NULL, 16); if (ref == 0) ref = None; fd[0] = atoi(argv[1]); fd[1] = atoi(argv[2]); SetMessageMask(fd, M_NEW_DESK | M_END_WINDOWLIST| M_MAP| M_RES_NAME| M_RES_CLASS| M_CONFIG_INFO| M_END_CONFIG_INFO| M_WINDOW_NAME); /* Enregistrement des arguments du script */ x11base=(X11base*) calloc(1,sizeof(X11base)); x11base->TabArg[0]=ModuleName; for (i=8-IsFather;i<argc;i++) x11base->TabArg[i-7+IsFather]=argv[i]; } else { fprintf(stderr,"%s requires only the path of the script.\n", ModuleName); exit(1); } ParseOptions(); SendText(fd,"Send_WindowList",0); ReadConfig(ScriptName); /* Lecture et analyse du script */ InitCom(); /* Fonction d'initialisation de TabCom et TabFunc */ BuildGUI(IsFather); /* Construction des boutons et de la fenetre */ ReadFvwmScriptArg(argc,argv,IsFather); MainLoop(); return 0; }
int main(int argc, char **argv) { struct RDArgs *rdargs = NULL; int i; char pubscreen[32]; if(argc) { rdargs=ReadArgs( TEMPLATE , (LONG *) &args, NULL); SaveIcons = FALSE; } else { struct WBStartup *WBenchMsg = (struct WBStartup *)argv; struct WBArg *wbarg; BPTR olddir; struct DiskObject *dobj; STRPTR* toolarray; UBYTE *s; SaveIcons = TRUE; for(i=0, wbarg=WBenchMsg->sm_ArgList; i < WBenchMsg->sm_NumArgs; i++, wbarg++) { olddir = (BPTR) -1; if((wbarg->wa_Lock)&&(*wbarg->wa_Name)) olddir = CurrentDir(wbarg->wa_Lock); if((*wbarg->wa_Name) && (dobj=GetDiskObject(wbarg->wa_Name))) { toolarray = dobj->do_ToolTypes; s = FindToolType(toolarray,"CREATEICONS"); if( s != NULL ) { if( MatchToolValue(s,"NO") || MatchToolValue(s,"FALSE")) { SaveIcons = FALSE; } } s = (char *) FindToolType(toolarray,"PUBSCREEN"); if( s != NULL ) { strncpy(pubscreen, s, sizeof pubscreen); args.pubscreen = pubscreen; } s = (char *) FindToolType(toolarray,"ACTION"); if( s != NULL ) { if(MatchToolValue(s,"EDIT")) { args.edit = TRUE; } else if(MatchToolValue(s,"USE")) { args.use = TRUE; } else if(MatchToolValue(s,"SAVE")) { args.save = TRUE; } } FreeDiskObject(dobj); } if((i>0)&&(*wbarg->wa_Name)) { args.from = wbarg->wa_Name; } if(olddir != (BPTR) -1) { CurrentDir(olddir); /* CD back where we were */ } } } if(args.from == NULL) { args.from = ENVFILE; } if(args.edit) { args.use = FALSE; args.save = FALSE; } if((SetSignal(0L,SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C) == 0) { if(Initialize()) { NewSettings(args.from); if((!args.use && !args.save) || args.edit) { if(BuildGUI(args.pubscreen)) { EventLoop(); } CloseGUI(); } if(args.use || args.save) { SaveSettings(ENVFILE, UnitList); } if(args.save) { SaveSettings(ENVARCFILE, UnitList); } } } if(rdargs) { FreeArgs(rdargs); } FreeVec(Units); FreeVec(Modes); FreeVec(Outputs); FreeVec(Inputs); FreeList(ModeList); FreeList(UnitList); CleanUp(); return 0; }
void PBox::AttachedToWindow(){ //calc font height (for nice control size) font_height fontHeight; be_bold_font->GetHeight(&fontHeight); fFontHeight = fontHeight.descent + fontHeight.leading + fontHeight.ascent; BRect frame = Bounds(); frame.InsetBy(5,5); BRect temp = frame; temp.bottom = temp.top + 40; SettingsTextView *testo1=new SettingsTextView(temp,"testo",_T("Settings")); AddChild(testo1); frame.top +=40; //BSeparator *sep=new BSeparator(frame,"sep","cippa"); //sep->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); //AddChild(sep); //frame.InsetBy(kEdgeOffset, kEdgeOffset); //frame.top += fFontHeight; //some space #if SCROLLBAR frame.right -= B_V_SCROLL_BAR_WIDTH + 2; #endif BView *view = new BView(frame, "", B_FOLLOW_ALL_SIDES,B_WILL_DRAW); #if B_BEOS_VERSION > B_BEOS_VERSION_5 view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); view->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); view->SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); #else view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); view->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); view->SetHighColor(0, 0, 0, 0); #endif float settings_height = BuildGUI(fTemplate, fData, view); view->ResizeTo( view->Bounds().Width(), settings_height); #if SCROLLBAR BScrollView * scroller = new BScrollView( "scroller", view, B_FOLLOW_ALL, 0, false, true ); float scroll_height = scroller->Bounds().Height(); float diff = settings_height - scroll_height; if ( diff < 0 ) diff = 0; scroller->ScrollBar(B_VERTICAL)->SetRange(0, diff); view = scroller; #endif fPrefView = view; AddChild(fPrefView); testo1->SetText(fTemplate.FindString("name")); }