Blame src/StatusLine.h

Packit Service a2489d
/*
Packit Service a2489d
 * lftp - file transfer program
Packit Service a2489d
 *
Packit Service a2489d
 * Copyright (c) 1996-2012 by Alexander V. Lukyanov (lav@yars.free.net)
Packit Service a2489d
 *
Packit Service a2489d
 * This program is free software; you can redistribute it and/or modify
Packit Service a2489d
 * it under the terms of the GNU General Public License as published by
Packit Service a2489d
 * the Free Software Foundation; either version 3 of the License, or
Packit Service a2489d
 * (at your option) any later version.
Packit Service a2489d
 *
Packit Service a2489d
 * This program is distributed in the hope that it will be useful,
Packit Service a2489d
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service a2489d
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service a2489d
 * GNU General Public License for more details.
Packit Service a2489d
 *
Packit Service a2489d
 * You should have received a copy of the GNU General Public License
Packit Service a2489d
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit Service a2489d
 */
Packit Service a2489d
Packit Service a2489d
#ifndef STATUSLINE_H
Packit Service a2489d
#define STATUSLINE_H
Packit Service a2489d
Packit Service a2489d
#include "SMTask.h"
Packit Service a2489d
#include "Timer.h"
Packit Service a2489d
#include "StringSet.h"
Packit Service a2489d
Packit Service a2489d
class StatusLine : public SMTask
Packit Service a2489d
{
Packit Service a2489d
   int fd;
Packit Service a2489d
   StringSet shown;
Packit Service a2489d
   bool	not_term;
Packit Service a2489d
   Timer update_timer;
Packit Service a2489d
   StringSet to_be_shown;
Packit Service a2489d
   char def_title[0x800];
Packit Service a2489d
   bool update_delayed;
Packit Service a2489d
   void update(const char *const *,int);
Packit Service a2489d
   void update(const char *s) { update(&s,1); }
Packit Service a2489d
   int LastWidth;
Packit Service a2489d
   int LastHeight;
Packit Service a2489d
   bool next_update_title_only;
Packit Service a2489d
   static const char *to_status_line, *from_status_line, *prev_line;
Packit Service a2489d
Packit Service a2489d
protected:
Packit Service a2489d
   void WriteTitle(const char *s, int fd) const;
Packit Service a2489d
Packit Service a2489d
public:
Packit Service a2489d
   int GetWidth();
Packit Service a2489d
   int GetHeight();
Packit Service a2489d
   int GetWidthDelayed() const { return LastWidth; }
Packit Service a2489d
   int GetHeightDelayed() const { return LastHeight; }
Packit Service a2489d
   void NextUpdateTitleOnly() { next_update_title_only=true; }
Packit Service a2489d
   void DefaultTitle(const char *s);
Packit Service a2489d
   void ShowN(const char *const* newstr,int n);
Packit Service a2489d
   void Show(const char *f,...) PRINTF_LIKE(2,3);
Packit Service a2489d
   void Show(const StringSet &s) { ShowN(s.Set(),s.Count()); }
Packit Service a2489d
   void Show(const StringSet *s) { Show(*s); }
Packit Service a2489d
   void WriteLine(const char *f,...) PRINTF_LIKE(2,3);
Packit Service a2489d
   void Clear(bool title_also=true);
Packit Service a2489d
   bool CanShowNow() { return update_timer.Stopped(); }
Packit Service a2489d
Packit Service a2489d
   int getfd() const { return fd; }
Packit Service a2489d
Packit Service a2489d
   StatusLine(int new_fd);
Packit Service a2489d
   ~StatusLine();
Packit Service a2489d
Packit Service a2489d
   int Do();
Packit Service a2489d
};
Packit Service a2489d
Packit Service a2489d
#endif // STATUSLINE_H