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