#
# This file is a part of the NsCDE - Not so Common Desktop Environment
# Author: Hegel3DReloaded
# Licence: GPLv3
#

WindowTitle {FPMonthDayApplet}
WindowSize 56 56
Colorset 23

Init
Begin
   Set $MainFont = (GetOutput {$NSCDE_TOOLSDIR/getfont -v -t normal -s small -Z 10.5} 1 -1)
   ChangeFont 3 $MainFont
   ChangeFont 4 $MainFont

   Set $month = (GetOutput {exec date +%h} 1 1)
   ChangeTitle  3 $month
   Set $day = (GetOutput {exec date +%e} 1 1)
   ChangeTitle 4 $day

   Key F1 A 2 3 {KeyHelp}
   Key Help A 2 3 {KeyHelp}
End

PeriodicTasks
Begin
   If (RemainderOfDiv (GetTime) 30) == 0 Then
   Begin
      Set $prevmtitle = $month
      Set $month =  (GetOutput {exec date +%h} 1 1)
      If $prevmtitle <> $month Then
         ChangeTitle 3 $month

      Set $prevdtitle = $day
      Set $day = (GetOutput {exec date +%e} 1 1)
      If $prevdtitle <> $day Then
         ChangeTitle 4 $day
   End
End

Widget 2
   Property
   Position 0 0
   Size 56 56
   Type ItemDraw
   Flags NoReliefString Left
   Icon NsCDE/FpCM.l.pm
   Title {}
   Main
      Case message of
      SingleClic :
      Begin
         SendSignal 2 1
      End
      1 :
      Begin
         Do {f_Calendar}
         ChangeColorset 2 24
         Do {f_UnclickScript 450 MonthDayApplet 2 2 unclick}
      End
      2 :
      Begin
         If (LastString) == {unclick} Then
         Begin
            ChangeColorset 2 23
         End
      End
      3 :
      Begin
         Do {f_DisplayURL "MonthDayApplet" html/NsCDE-MonthDayApplet.html}
      End
End

Widget 3
   Property
   Position 16 11
   Size 0 17
   Type ItemDraw
   ForeColor {#000000}
   BackColor {#bdbdbd}
   Flags NoReliefString Center
   Title {XXX}
   Font "xft:::pixelsize=12"
   Main
      Case message of
      SingleClic :
      Begin
         SendSignal 2 1
      End
End

Widget 4
   Property
   Position 19 27
   Size 0 0
   Type ItemDraw
   ForeColor {black}
   BackColor {#bdbdbd}
   Flags NoReliefString Center
   Title {XX}
   Font "xft:::pixelsize=12"
   Main
      Case message of
      SingleClic :
      Begin
         SendSignal 2 1
      End
End

