- GPSPage(DCLGPS* parent);
- virtual ~GPSPage() = 0;
- virtual void Update(double dt);
- virtual void Knob1Left1();
- virtual void Knob1Right1();
- virtual void Knob2Left1();
- virtual void Knob2Right1();
- virtual void CrsrPressed();
- virtual void EntPressed();
- virtual void ClrPressed();
- virtual void DtoPressed();
- virtual void NrstPressed();
- virtual void AltPressed();
- virtual void OBSPressed();
- virtual void MsgPressed();
-
- // Sometimes a page needs to maintain state for some return paths,
- // but change it for others. The CleanUp function can be used for
- // changing state for non-ENT return paths in conjunction with
- // GPS::_cleanUpPage
- virtual void CleanUp();
-
- // The LooseFocus function is called when a page or subpage looses focus
- // and allow pages to clean up state that is maintained whilst focus is
- // retained, but lost on return.
- virtual void LooseFocus();
-
- // Allows pages that display info for a given ID to have it set/get if they implement these functions.
- virtual void SetId(string s);
- virtual string GetId();
-
- inline int GetSubPage() { return(_subPage); }
-
- inline int GetNSubPages() { return(_nSubPages); }
-
- inline string GetName() { return(_name); }
-
-protected:
- DCLGPS* _parent;
- string _name; // eg. "APT", "NAV" etc
- int _nSubPages;
- // _subpage is zero based
- int _subPage; // The subpage gets remembered when other pages are displayed
- string GPSitoa(int n);
-};
+ ClockTime();
+ ClockTime(int hr, int min);
+ ~ClockTime();
+ inline void set_hr(int hr) { _hr = hr; }
+ inline int hr() const { return(_hr); }
+ inline void set_min(int min) { _min = min; }
+ inline int min() const { return(_min); }
+
+ ClockTime operator+ (const ClockTime& t) {
+ int cumMin = _hr * 60 + _min + t.hr() * 60 + t.min();
+ ClockTime t2(cumMin / 60, cumMin % 60);
+ return(t2);
+ }
+ // Operator - has a max difference of 23:59,
+ // and assumes the day has wrapped if the second operand
+ // is larger that the first.
+ // eg. 2:59 - 3:00 = 23:59
+ ClockTime operator- (const ClockTime& t) {
+ int diff = (_hr * 60 + _min) - (t.hr() * 60 + t.min());
+ if(diff < 0) { diff += 24 * 60; }
+ ClockTime t2(diff / 60, diff % 60);
+ return(t2);
+ }
+ friend std::ostream& operator<< (std::ostream& out, const ClockTime& t);