MainWindow :: MainWindow( const Rect & r ) : Window( r, "MainWindow", "sIRC", 0, CURRENT_DESKTOP ) { /* Set up "view" as the main view for the window, filling up the entire */ /* window (thus the call to GetBounds()). */ view = new MainView( GetBounds() ); AddChild( view ); AddMailbox("MainWindow"); };
Remsa::Remsa(const Rect & r) :Window(r, "PaperRoll", MSG_PAPERROLL_TITLE, 0, CURRENT_DESKTOP) { Rect bounds = GetBounds(); m_Visible = false; m_TextView = new PaperRoll(bounds, "tv", "", CF_FOLLOW_ALL, WID_FULL_UPDATE_ON_RESIZE | WID_WILL_DRAW); m_TextView->SetMultiLine(true); m_TextView->SetReadOnly(true); Font* pcAppFont = new Font ( DEFAULT_FONT_FIXED ); pcAppFont->SetSize( 8 ); m_TextView->SetFont(pcAppFont); pcAppFont->Release(); AddChild(m_TextView); AddMailbox("PaperRoll"); }
MainView::MainView(const Rect& cRect) : LayoutView(cRect, "MainView") // Here is where we construct the window e.g views, buttons, textviews, etc... { //create the vertical root layout node LayoutNode* pcRootNode = new VLayoutNode("Root"); //create textview //top spacer pcRootNode->AddChild(new VLayoutSpacer("Spacer1", 19, 19)); //create output box Rect y; y.Resize(0,0,0,0); textOutputView = new TextView (y, "OutputView", "", CF_FOLLOW_ALL ); textOutputView ->SetMultiLine(true); textOutputView ->SetReadOnly(true); pcRootNode->AddChild(textOutputView); //spacer between input and output pcRootNode->AddChild(new VLayoutSpacer("Spacer2", 5, 5)); //create horizontal layer LayoutNode* pcButtonNode = new HLayoutNode("Buttons", 0); pcButtonNode->AddChild(new HLayoutSpacer("Spacer3", 5, 5)); //create input box Rect x; x.Resize( 0,0,0,0); // TextView* textInputView = new TextView (x, "InputView", "Input", CF_FOLLOW_ALL ); textInputView = new TextView (x, "InputView", "Input", CF_FOLLOW_ALL ); pcButtonNode->AddChild(textInputView); //bottom spacer pcButtonNode->AddChild(new HLayoutSpacer("Spacer4", 5, 5)); m_pcStart = new Button(Rect(0, 0, 0, 0), "Send", "Send", new Message(MSG_SEND)); m_pcStart->GetFont()->SetSize(10); pcButtonNode->AddChild(m_pcStart); pcButtonNode->AddChild(new HLayoutSpacer("Spacer5", 5, 5)); m_pcStart->GetPreferredSize (false).y; //add the row of buttons to the vertical layout node pcRootNode->AddChild(new VLayoutSpacer("Spacer6", 10, 10)); pcRootNode->AddChild(pcButtonNode); pcRootNode->AddChild(new VLayoutSpacer("Spacer7", 10, 10)); //add it all to this layout view SetRoot(pcRootNode); // Menu *mainMenuBar, *tempMenu; mainMenuBar = new Menu( Rect(0,0,0,0), "mainMenuBar", ITEMS_IN_ROW ); mainMenuBar ->SetFrame ( Rect (0, 0, GetBounds().Width() + 1, 18) ); // App menu tempMenu = new Menu( Rect(0,0,0,0), "Application", ITEMS_IN_COLUMN ); tempMenu->AddItem( "Settings", new Message(MSG_SETTINGS)); tempMenu->AddItem("About", new Message(M_MENU_ABO)); tempMenu->AddItem("Quit", new Message(M_MENU_QUIT)); mainMenuBar->AddItem( tempMenu ); // File menu tempMenu = new Menu( Rect(0,0,0,0), "Server", ITEMS_IN_COLUMN ); tempMenu->AddItem( "Connect", new Message(M_MENU_CONNECT) ); tempMenu->AddItem( "Login", new Message(M_MENU_LOGIN) ); tempMenu->AddItem( "Disconnect", new Message(M_MENU_DISCONNECT) ); mainMenuBar->AddItem( tempMenu ); // Help menu tempMenu = new Menu( Rect(0,0,0,0), "Channel", ITEMS_IN_COLUMN ); tempMenu->AddItem( "Join Channel", new Message(MSG_JOINCHANNEL) ); tempMenu->AddItem( "Send Message", new Message(MSG_SEND) ); mainMenuBar->AddItem( tempMenu ); AddChild( mainMenuBar ); // mainMenuBar->SetTargetForItems( this ); m_CommThread = new CommThread( this ); m_CommThread->Run(); AddMailbox("MainView"); }
CommThread :: CommThread( const Messenger& cTarget ): Looper( "comm_worker" ) { m_cTarget = cTarget; m_eState = S_STOP; AddMailbox("Commthread"); }