The R Project SVN R

Rev

Rev 45017 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4394 ripley 1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1999  Guido Masarotto
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU General Public License
42300 ripley 16
 *  along with this program; if not, a copy is available at
68956 ripley 17
 *  https://www.R-project.org/Licenses/
4394 ripley 18
 */
19
 
20
/*
21
 *  int addstatusbar()  - add a simple status bar to the mdi frame
22
 *  void setstatus(char *text) - set text
23
 */
24
 
25
/*
26
   This file is an add-on  to GraphApp, a cross-platform C graphics library.
27
 */
28
 
29
#include "internal.h"
30
 
31
static char MDIStatusText[256] = "" ;
5429 ripley 32
#ifndef SBARS_SIZEGRIP
33
#include "commctrl.h"
34
#endif
4394 ripley 35
 
40579 ripley 36
static HWND intMDIStatus=0;
37
 
45017 ripley 38
int addstatusbar()
39
{
40
    int a[1] = {-1};
41
    if (!MDIFrame) return 0;
42
    if (MDIStatus) return 1;
43
    if(!intMDIStatus) {
44
	InitCommonControls();
45
	intMDIStatus = CreateStatusWindow(WS_CHILD|SBARS_SIZEGRIP|WS_VISIBLE,
46
					  "", hwndFrame, 121);
47
	if (!intMDIStatus) return 0;
48
	SendMessage(intMDIStatus,SB_SETPARTS,(WPARAM)1,(LPARAM)a);
49
	SendMessage(intMDIStatus,SB_SETTEXT,
50
		    (WPARAM) 0|0, (LPARAM)MDIStatusText);
51
    }
52
    MDIStatus = intMDIStatus;
53
    SendMessage(hwndFrame,WM_PAINT,(WPARAM) 0,(LPARAM) 0);
54
    return 1;
4394 ripley 55
}
56
 
45017 ripley 57
int delstatusbar()
58
{
59
    if (!MDIFrame) return 0;
60
    MDIStatus = 0; /* handle_mdiframeresize notices this */
61
    SendMessage(hwndFrame,WM_PAINT,(WPARAM) 0,(LPARAM) 0);
62
    return 1;
40579 ripley 63
}
4394 ripley 64
 
45017 ripley 65
PROTECTED void updatestatus(const char *text)
66
{
40594 ripley 67
    /* strncpy(MDIStatusText, text, 255); */
45017 ripley 68
    if (!MDIStatus) return;
69
    SendMessage(MDIStatus,SB_SETTEXT,
70
		(WPARAM) 0|0, (LPARAM)MDIStatusText);
71
    SendMessage(MDIStatus, WM_PAINT, (WPARAM)0, (LPARAM)0);
4394 ripley 72
}
73
 
45017 ripley 74
void setstatus(const char *text)
75
{
76
    strncpy(MDIStatusText, text, 255);
77
    if (!MDIStatus || !current_window) return;
78
    strncpy(current_window->status, text, 255);
79
    updatestatus(text);
4394 ripley 80
}