| 1 |
/* -*-C++-*- |
| 2 |
|
| 3 |
"$Id: Fl_Calendar.H,v 1.4 2000/02/13 04:43:56 jamespalmer Exp $" |
| 4 |
|
| 5 |
Copyright 1999-2010 by the Flek development team. |
| 6 |
*/ |
| 7 |
// ---------------------------------------------------------------------------- |
| 8 |
// Copyright (C) 2014 |
| 9 |
// David Freese, W1HKJ |
| 10 |
// |
| 11 |
// This file is part of flmsg |
| 12 |
// |
| 13 |
// flrig is free software; you can redistribute it and/or modify |
| 14 |
// it under the terms of the GNU General Public License as published by |
| 15 |
// the Free Software Foundation; either version 3 of the License, or |
| 16 |
// (at your option) any later version. |
| 17 |
// |
| 18 |
// flrig is distributed in the hope that it will be useful, |
| 19 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 |
// GNU General Public License for more details. |
| 22 |
// |
| 23 |
// You should have received a copy of the GNU General Public License |
| 24 |
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 25 |
// ---------------------------------------------------------------------------- |
| 26 |
|
| 27 |
#ifndef _FL_CALENDAR_H |
| 28 |
#define _FL_CALENDAR_H |
| 29 |
|
| 30 |
#include <FL/Fl_Window.H> |
| 31 |
#include <FL/Fl_Group.H> |
| 32 |
#include <FL/Fl_Button.H> |
| 33 |
#include <FL/Fl_Box.H> |
| 34 |
|
| 35 |
#include "flinput2.h" |
| 36 |
#include "date.h" |
| 37 |
|
| 38 |
class Fl_Calendar_Base : public Fl_Group , public Date |
| 39 |
{ |
| 40 |
private: |
| 41 |
|
| 42 |
protected: |
| 43 |
|
| 44 |
int cal_x; |
| 45 |
int cal_y; |
| 46 |
int cal_w; |
| 47 |
int cal_h; |
| 48 |
|
| 49 |
Fl_Button * days[6*7]; |
| 50 |
|
| 51 |
public: |
| 52 |
Fl_Widget *target; |
| 53 |
int calfmt; |
| 54 |
|
| 55 |
/** |
| 56 |
* The constructor for an empty Fl_Calendar_Base. |
| 57 |
*/ |
| 58 |
Fl_Calendar_Base (int x, int y, int w = (7*20), int h = (6*20), |
| 59 |
const char *l = 0); |
| 60 |
|
| 61 |
Fl_Button * day_button (int i); |
| 62 |
|
| 63 |
void update (); |
| 64 |
void csize (int cx, int cy, int cw, int ch); |
| 65 |
void setTarget (Fl_Widget *tgt); |
| 66 |
}; |
| 67 |
|
| 68 |
class Fl_Calendar : public Fl_Calendar_Base |
| 69 |
{ |
| 70 |
public: |
| 71 |
/** |
| 72 |
* The constructor for an empty Fl_Calendar. |
| 73 |
*/ |
| 74 |
Fl_Calendar (int x, int y, int w = (7*20), int h = (8*20), |
| 75 |
const char *l = 0); |
| 76 |
|
| 77 |
void today (); |
| 78 |
void previous_month (); |
| 79 |
void next_month (); |
| 80 |
void previous_year (); |
| 81 |
void next_year (); |
| 82 |
void setDate (int, int, int); |
| 83 |
|
| 84 |
void update (); |
| 85 |
void csize (int cx, int cy, int cw, int ch); |
| 86 |
int handle (int); |
| 87 |
void local_datetime() { use_local = true; } |
| 88 |
|
| 89 |
protected: |
| 90 |
// Fl_Button * weekdays[7]; |
| 91 |
// Fl_Button * caption; |
| 92 |
Fl_Box * weekdays[7]; |
| 93 |
Fl_Box * caption; |
| 94 |
Fl_Button * nxt_month; |
| 95 |
Fl_Button * prv_month; |
| 96 |
Fl_Button * nxt_year; |
| 97 |
Fl_Button * prv_year; |
| 98 |
bool use_local; |
| 99 |
}; |
| 100 |
|
| 101 |
class Fl_PopCal : public Fl_Window { |
| 102 |
|
| 103 |
friend void popcal_cb(Fl_Widget *, long); |
| 104 |
|
| 105 |
protected: |
| 106 |
int popcalfmt_; |
| 107 |
// Fl_Window popcal_form; |
| 108 |
Fl_Calendar *popcal; |
| 109 |
Fl_Input2 *target; |
| 110 |
public: |
| 111 |
Fl_PopCal (int x, int y, int w, int h, Fl_Input2 *inp = 0); |
| 112 |
~Fl_PopCal (); |
| 113 |
void popposition (int, int); |
| 114 |
void popshow (); |
| 115 |
void pophide (); |
| 116 |
void popcal_cb_i (Fl_Widget *, long); |
| 117 |
void popcalfmt (int); |
| 118 |
int popcalfmt (); |
| 119 |
int handle (int); |
| 120 |
void setDate (int, int, int); |
| 121 |
}; |
| 122 |
|
| 123 |
class Fl_DateInput : public Fl_Group { |
| 124 |
|
| 125 |
protected: |
| 126 |
Fl_Button *Btn; |
| 127 |
Fl_Input2 *Input; |
| 128 |
Fl_PopCal *Cal; |
| 129 |
|
| 130 |
Fl_Window *popcal_form; |
| 131 |
Fl_Calendar *popcal; |
| 132 |
int popcalfmt_; |
| 133 |
bool use_local; |
| 134 |
|
| 135 |
void makepopcal(); |
| 136 |
|
| 137 |
public: |
| 138 |
Fl_DateInput (int x, int y, int w, int h, const char * = 0); |
| 139 |
|
| 140 |
void format (int); |
| 141 |
const char *value (); |
| 142 |
void value (const char *); |
| 143 |
void textfont (int); |
| 144 |
void textsize (int); |
| 145 |
void labelfont (int); |
| 146 |
void labelsize (int); |
| 147 |
void labelcolor (int); |
| 148 |
void align (Fl_Align); |
| 149 |
void fl_popcal(); |
| 150 |
void take_focus(); |
| 151 |
void local_datetime(bool val = true) { |
| 152 |
use_local = val; |
| 153 |
} |
| 154 |
|
| 155 |
}; |
| 156 |
|
| 157 |
|
| 158 |
#endif |