| 1 |
/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ |
| 2 |
|
| 3 |
/* AbiSource Program Utilities |
| 4 |
* |
| 5 |
* Copyright (C) 2002 Francis James Franklin <[email protected]> |
| 6 |
* Copyright (C) 2002 AbiSource, Inc. |
| 7 |
* |
| 8 |
* This program is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU General Public License |
| 10 |
* as published by the Free Software Foundation; either version 2 |
| 11 |
* of the License, or (at your option) any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program; if not, write to the Free Software |
| 20 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 21 |
* 02110-1301 USA. |
| 22 |
*/ |
| 23 |
|
| 24 |
#include "ut_sleep.h" |
| 25 |
|
| 26 |
#include "xap_StatusBar.h" |
| 27 |
|
| 28 |
/* This allows for up to two concurrently active status bars, since |
| 29 |
* the splash screen may still be active when the application's |
| 30 |
* principal status bar registers... |
| 31 |
* - FIXME: this can be removed, as I killed off the splash screen - MARCM |
| 32 |
*/ |
| 33 |
static XAP_StatusBar * s_SB1 = 0; |
| 34 |
static XAP_StatusBar * s_SB2 = 0; |
| 35 |
|
| 36 |
void XAP_StatusBar::setStatusBar (XAP_StatusBar * statusbar) |
| 37 |
{ |
| 38 |
if (s_SB1 == 0) |
| 39 |
{ |
| 40 |
s_SB1 = statusbar; |
| 41 |
return; |
| 42 |
} |
| 43 |
if (s_SB2 == 0) |
| 44 |
{ |
| 45 |
s_SB2 = statusbar; |
| 46 |
return; |
| 47 |
} |
| 48 |
message ("Too many status bars!!!", true); // :-) |
| 49 |
} |
| 50 |
|
| 51 |
void XAP_StatusBar::unsetStatusBar (XAP_StatusBar * statusbar) |
| 52 |
{ |
| 53 |
if (s_SB1 == statusbar) s_SB1 = 0; |
| 54 |
if (s_SB2 == statusbar) s_SB2 = 0; |
| 55 |
} |
| 56 |
|
| 57 |
void XAP_StatusBar::message (const char * pbuf, bool urgent) |
| 58 |
{ |
| 59 |
if (s_SB1 || s_SB2) |
| 60 |
{ |
| 61 |
if (s_SB1) s_SB1->statusMessage (pbuf, urgent); |
| 62 |
if (s_SB2) s_SB2->statusMessage (pbuf, urgent); |
| 63 |
|
| 64 |
if (urgent) UT_usleep (1000000); |
| 65 |
} |
| 66 |
} |
| 67 |
|
| 68 |
void XAP_StatusBar::debugmsg (const char * pbuf, bool urgent) |
| 69 |
{ |
| 70 |
if (s_SB2) |
| 71 |
{ |
| 72 |
s_SB2->statusMessage (pbuf, urgent); |
| 73 |
|
| 74 |
if (urgent) UT_usleep (1000000); |
| 75 |
} |
| 76 |
} |