void parse_input (Tree *T, char *token) { void *check = NULL; int parameter = atoi(token + 1); char instruction[INSTRUCTION]; instruction[1] = '\0'; instruction[0] = toupper((int)token[0]); if (parameter == 0) { ERROR ("A key of integer value zero is not allowed."); } printf("\nReceived: instruction=%s, parameter=%d.\n", instruction,parameter); int *vptr = ¶meter; if (strsame(instruction, "S")) { check = find (T, vptr); if (check) { fprintf (stderr, "Node with key %d was found in the tree.\n", *((int*)check)); } else { fprintf (stderr, "Node with key %d was NOT found in the tree.\n", parameter); check = vptr; } } else if (strsame(instruction, "I")) { check = insert_control (T, vptr); if (check) { fprintf (stderr, "Node with key %d successfully inserted in the tree.\n", *((int*)check)); } } else if (strsame(instruction, "D")) { check = delete_control (T, vptr); if (check) { fprintf (stderr, "Node with key %d successfully deleted from the tree.\n", *((int*)check)); } } if (check == NULL) { fprintf (stderr, "Node with key %d is already in the tree.\n", parameter); } }
/** * \brief Create the "Next" button. */ bear::gui::visual_component* ptb::frame_play_story::create_next_button() { bear::gui::button* result = new bear::gui::button ( get_font(), gettext("Next"), bear::gui::callback_function_maker ( boost::bind( &frame_play_story::on_next, this ) ) ); result->set_margin( get_margin() / 2 ); set_borders_up( *result ); insert_control( *result ); return result; } // frame_play_story::create_next_button()
/** * \brief Create all bonus components. */ void ptb::frame_play_story::create_bonus_component() { m_bonus = new bear::gui::horizontal_flow(3, 3, bear::visual::color_type("e50f0f")); get_content().insert( m_bonus ); m_bonus->set_background_color(PTB_THEME_FACE); set_borders_down(*m_bonus); insert_control( *m_bonus ); m_bonus_text = new bear::gui::static_text(get_font()); insert( m_bonus_text ); m_bonus_text->set_background_color(PTB_THEME_FACE); set_borders_down(*m_bonus_text); } // frame_play_story::create_bonus_component()
/** * \brief Create the "remove" button. * \param f The font to use for the texts. */ bear::gui::visual_component* ptb::frame_profiles::create_remove_button( bear::visual::font f ) { bear::gui::button* result = new bear::gui::button ( f, gettext("Remove"), bear::gui::callback_function_maker ( boost::bind(&frame_profiles::on_remove, this) ) ); result->set_margin( get_margin() / 2 ); set_borders_up(*result); insert_control(*result); return result; } // frame_profiles::create_remove_button()