EDE_Calendar::EDE_Calendar(int x,int y,int w,int h,const char *lbl) : Fl_Group(x,y,w,h,lbl) { unsigned int i; // Calendar contents, correct size and position is set by layout() // Header box m_monthNameBox = new Fl_Box(x,y,w,16); m_monthNameBox->box(FL_NO_BOX); // Weekday headers for (i = 0; i < 7; i++) { m_dayNameBoxes[i] = new Fl_Box(x+i*16,y+16,16,16); m_dayNameBoxes[i]->box(FL_FLAT_BOX); m_dayNameBoxes[i]->color(fl_color_average(color(), FL_GREEN, 0.8)); // get first two letters of day name edelib::Date d; d.set(1900,1,7+i); // 1.1.1900 was Monday char tmp[3]; snprintf(tmp,3,"%s", d.day_name()); m_dayNameBoxes[i]->copy_label(tmp); } // Fillers (parts of calendar without day buttons) for (int i=0; i<3; i++) { m_filler[i] = new Fl_Box(x,y,16,16); m_filler[i]->box(FL_FLAT_BOX); m_filler[i]->color(fl_color_average(color(), FL_BLACK, 0.95)); // very mild grayish } // Day buttons for (i = 0; i < 31; i++) { m_dayButtons[i] = new Fl_Box(0,0,16,16); char tmp[3]; snprintf(tmp,3, "%d", (i+1)); m_dayButtons[i]->copy_label(tmp); } // Switch buttons for (i = 0; i < 4; i++) { Fl_Repeat_Button* o; m_switchButtons[i] = o = new Fl_Repeat_Button(x,y,16,16,switchLabels[i]); o->callback(EDE_Calendar::cbSwitchButtonClicked, (long)monthChanges[i]); o->labelcolor(fl_darker(FL_BACKGROUND_COLOR)); o->selection_color(fl_lighter(FL_BACKGROUND_COLOR)); } end(); reset(); // this will eventually call layout() }
//==== Create & Init Gui Slider Adjustable Range ====// void GroupLayout::AddSlider( SliderAdjRangeInput& slid_adj_input, const char* label, double range, const char* format ) { assert( m_Group && m_Screen ); int init_used_w = m_X - m_Group->x(); //==== Parm Button ====// VspButton* button = AddParmButton( label ); //==== Range Button ====// Fl_Repeat_Button* lbutton = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, "<" ); lbutton->box( FL_THIN_UP_BOX ); lbutton->labelcolor( ( Fl_Color )4 ); m_Group->add( lbutton ); AddX( m_RangeButtonWidth ); //==== Slider ====// int sw = FitWidth( m_ButtonWidth + 2 * m_RangeButtonWidth + m_InputWidth + init_used_w, m_SliderWidth ); Fl_Slider* slider = new Fl_Slider( m_X, m_Y, sw, m_StdHeight ); slider->type( 5 ); slider->box( FL_THIN_DOWN_BOX ); slider->color( FL_BACKGROUND2_COLOR ); slider->selection_color( FL_SELECTION_COLOR ); m_Group->add( slider ); AddX( sw ); //==== Range Button ====// Fl_Repeat_Button* rbutton = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, "<" ); rbutton->box( FL_THIN_UP_BOX ); rbutton->labelcolor( ( Fl_Color )4 ); m_Group->add( rbutton ); AddX( m_RangeButtonWidth ); //==== Input ====// Fl_Float_Input* input = new Fl_Float_Input( m_X, m_Y, m_InputWidth, m_StdHeight ); input->type( 1 ); input->box( FL_THIN_DOWN_BOX ); input->textsize( 12 ); input->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE ); m_Group->add( input ); AddX( m_InputWidth ); AddY( m_StdHeight ); NewLineX(); slid_adj_input.Init( m_Screen, slider, lbutton, rbutton, input, range, format, button ); if( strcmp( label, "AUTO_UPDATE" ) == 0 || strcmp( label, "" ) == 0 ) { slid_adj_input.SetButtonNameUpdate( true ); } }
//==== Add Fuselage Skin Control Group ====// void GroupLayout::AddSkinControl( SkinControl & skin_control, const char* label, double range, const char* format ) { assert( m_Group && m_Screen ); int sw = FitWidth( 3 * m_StdHeight + m_ButtonWidth + 2 * m_InputWidth + 4 * m_RangeButtonWidth, 2 * m_SliderWidth )/2; //==== Left Min Range Button ====// Fl_Repeat_Button* minbuttonL = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, "<" ); minbuttonL->box( FL_THIN_UP_BOX ); minbuttonL->labelcolor( ( Fl_Color )4 ); m_Group->add( minbuttonL ); AddX( m_RangeButtonWidth ); //==== Left Slider ====// Fl_Slider* sliderL = new Fl_Slider( m_X, m_Y, sw, m_StdHeight ); sliderL->type( 5 ); sliderL->box( FL_THIN_DOWN_BOX ); sliderL->color( FL_BACKGROUND2_COLOR ); sliderL->selection_color( FL_SELECTION_COLOR ); m_Group->add( sliderL ); AddX( sw ); //==== Left Max Range Button ====// Fl_Repeat_Button* maxbuttonL = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, ">" ); maxbuttonL->box( FL_THIN_UP_BOX ); maxbuttonL->labelcolor( ( Fl_Color )4 ); m_Group->add( maxbuttonL ); AddX( m_RangeButtonWidth ); //==== Left Input ====// Fl_Float_Input* inputL = new Fl_Float_Input( m_X, m_Y, m_InputWidth, m_StdHeight ); inputL->type( 1 ); inputL->box( FL_THIN_DOWN_BOX ); inputL->textsize( 12 ); inputL->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE ); m_Group->add( inputL ); AddX( m_InputWidth ); //==== Left Set Check Button ====// Fl_Check_Button* setButtonL = new Fl_Check_Button( m_X, m_Y, m_StdHeight, m_StdHeight ); m_Group->add( setButtonL ); AddX( m_StdHeight ); //==== Parm Button ====// VspButton* parm_button = AddParmButton( label ); //==== Set Equality Check Button ====// Fl_Check_Button* setButtonEqual = new Fl_Check_Button( m_X, m_Y, m_StdHeight, m_StdHeight ); m_Group->add( setButtonEqual ); AddX( m_StdHeight ); //==== Right Set Check Button ====// Fl_Check_Button* setButtonR = new Fl_Check_Button( m_X, m_Y, m_StdHeight, m_StdHeight ); m_Group->add( setButtonR ); AddX( m_StdHeight ); //==== Right Min Range Button ====// Fl_Repeat_Button* minbuttonR = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, "<" ); minbuttonR->box( FL_THIN_UP_BOX ); minbuttonR->labelcolor( ( Fl_Color )4 ); m_Group->add( minbuttonR ); AddX( m_RangeButtonWidth ); //==== Right Slider ====// Fl_Slider* sliderR = new Fl_Slider( m_X, m_Y, sw, m_StdHeight ); sliderR->type( 5 ); sliderR->box( FL_THIN_DOWN_BOX ); sliderR->color( FL_BACKGROUND2_COLOR ); sliderR->selection_color( FL_SELECTION_COLOR ); m_Group->add( sliderR ); AddX( sw ); //==== Right Max Range Button ====// Fl_Repeat_Button* maxbuttonR = new Fl_Repeat_Button( m_X, m_Y, m_RangeButtonWidth, m_StdHeight, ">" ); maxbuttonR->box( FL_THIN_UP_BOX ); maxbuttonR->labelcolor( ( Fl_Color )4 ); m_Group->add( maxbuttonR ); AddX( m_RangeButtonWidth ); //==== Right Input ====// Fl_Float_Input* inputR = new Fl_Float_Input( m_X, m_Y, m_InputWidth, m_StdHeight ); inputR->type( 1 ); inputR->box( FL_THIN_DOWN_BOX ); inputR->textsize( 12 ); inputR->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE ); m_Group->add( inputR ); AddX( m_InputWidth ); AddY( m_StdHeight ); NewLineX(); skin_control.Init( m_Screen, setButtonL, setButtonEqual, setButtonR, sliderL, minbuttonL, maxbuttonL, sliderR, minbuttonR, maxbuttonR, inputL, inputR, parm_button, range, format); }