/* * Class TimeBrowser is a View class that implements the time the editing * component of the instructor prefs interface. It's composed fundamentally of * an HBox of text editors. The leftmost text editor is read-only, since it * contains the time labels. The other editors are a sublass Sted, with Tab * and Return specialized to tab horizontally to next editable label and move * vertically in the current column, respecitively. * * See timeprefs.h for the the companion Model class. */ #include #include #include #include "time_editor.h" class TimeBrowser : public MonoScene { public: TimeBrowser(int starttime, int endtime, int granularity); /* * Construct a browser with the given start time, end time, and time * granularity. E.g., 8AM, 5PM, 30 min. The time values must be 4-digit * integers in 24-hour time. The time granularity must be an integer * between 1 and 60. */ protected: HBox* ComposeEditors(int starttime, int endtime, int granularity); /* * Build the text editors that comprise each column of the time prefs * display. */ VBox* ComposeLeftColumn( int starttime, int endtime, int granularity, int& numrows); /* * Build the left column that contains the hours of the day, starting at * the given starttime, ending at the given end time, and separated by the * given granularity. Return the total number of rows (i.e., time slots) * in the given numrows ref parm. */ VBox* ComposeColumn(char* title, int numrows, TimeEditor* te); /* * Compose one of the days of the week columns, with the given column * heading and the given number of rows. */ void SetInitialTimes(TimeEditor* ed, int starttime, int numrows); /* * Set the intial time values in the lefthand display editor. */ HBox* columns; /* The hbox of labled text editors. */ int numcolumns; /* Fixed number of text editor columns (this should * probably be a constructor parm). */ TimeEditor* mon ; TimeEditor* tue ; TimeEditor* wed ; TimeEditor* thu ; TimeEditor* fri ; };