Subversion Repositories Filer-Free

Rev

Rev 16 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16 Rev 64
Line 2... Line 2...
2
// Copyright © 2007 Graham Shaw.
2
// Copyright © 2007 Graham Shaw.
3
// Redistribution and modification are permitted under the terms of the
3
// Redistribution and modification are permitted under the terms of the
4
// GNU General Public License (version 2 or any later version).
4
// GNU General Public License (version 2 or any later version).
5
 
5
 
6
#include <cstring>
6
#include <cstring>
-
 
7
#include <new>
7
 
8
 
8
#include "menu_item.h"
9
#include "menu_item.h"
9
#include "menu.h"
10
#include "menu.h"
10
#include "application.h"
11
#include "application.h"
11
 
12
 
12
menu::menu(application* app,char* title,unsigned int size):
13
menu::menu(application* app,char* title,unsigned int size):
13
        component(app),
14
        component(app),
14
        _data(0)
15
        _data(0)
15
{
16
{
16
        // Allocate data block.
17
        // Allocate data block.
-
 
18
        _data=(wimp_menu*)new(std::nothrow)
17
        _data=(wimp_menu*)new char[sizeof(wimp_menu)+size*sizeof(wimp_menu_entry)];
19
                char[sizeof(wimp_menu)+size*sizeof(wimp_menu_entry)];
18
 
20
 
19
        // Initialise menu header.
21
        // Initialise menu header.
20
        std::strcpy(_data->title_data.text,title);
22
        std::strcpy(_data->title_data.text,title);
21
        _data->title_fg=wimp_COLOUR_BLACK;
23
        _data->title_fg=wimp_COLOUR_BLACK;
22
        _data->title_bg=wimp_COLOUR_LIGHT_GREY;
24
        _data->title_bg=wimp_COLOUR_LIGHT_GREY;