//==== Add Sub Group Layout At Current Position ====// void GroupLayout::AddCounter( Counter & count, const char* label ) { assert( m_Group && m_Screen ); //==== Counter Button ====// VspButton* button = NULL; if ( strcmp( label, "" ) != 0 ) { VspButton* button = AddParmButton( label ); button->align( Fl_Align( FL_ALIGN_CLIP ) ); } //==== Counter ====// int counter_w = FitWidth( m_ButtonWidth, m_SliderWidth ); Fl_Counter* fl_counter = new Fl_Counter( m_X, m_Y, counter_w, m_StdHeight ); fl_counter->type( FL_SIMPLE_COUNTER ); fl_counter->minimum( 0 ); fl_counter->maximum( 10000 ); fl_counter->step( 1 ); m_Group->add( fl_counter ); AddX( counter_w ); count.Init( m_Screen, fl_counter, button ); AddY( m_StdHeight ); NewLineX(); }
int _tmain(int argc, _TCHAR* argv[]) { // 初始化socket环境 ISocketHandler::InitEnvironment(); // 初始化消息计算器 (文字和表情,和票根有关) g_msgCounter.Init(); // 创建并初始化 客户端 g_client = ILiveChatClient::CreateClient(); // 进入命令行状态 if (NULL != g_client) { // 初始化 printf("LiveChatClient is running! Please input command, 'help' print all command.\n"); char command[2048] = {0}; //事件对象 g_waitRespondEvent = CreateEvent(NULL, FALSE, TRUE, NULL); bool exit = false; // 循环处理线程 g_isLoopThreadRun = true; IThreadHandler* threadHandler = IThreadHandler::CreateThreadHandler(); threadHandler->Start(LoopThreadProc, NULL); // 处理main命令 if (argc >= 2) { exit = HandleArg(argv[1]); } // 处理用户输入 while (!exit) { // 等待回调事件 WaitForSingleObject(g_waitRespondEvent, INFINITE); // 打印命令输入提示符 printf("> "); // 用户输入命令 gets_s(command, sizeof(command)); // 处理命令 bool isWait = false; exit = HandleCmd(command, isWait); if (exit) { break; } // 不用等待回调,则改变信号量,立即进入命令行状态 if (!isWait) { SetEvent(g_waitRespondEvent); } } // 停止循环处理线程 g_isLoopThreadRun = false; threadHandler->WaitAndStop(); IThreadHandler::ReleaseThreadHandler(threadHandler); // 释放 ILiveChatClient::ReleaseClient(g_client); g_client = NULL; } else { printf("CreateClient fail!\n"); } printf("shutdown Now!\n"); // 释放socket环境 ISocketHandler::ReleaseEnvironment(); return 0; }