19#define __STDBOOL_H__ 1
48 void Failure(
const char* error);
68 : BWindow(BRect(30, 30, 400, 200),
"Downloads", B_TITLED_WINDOW,
78 BRect
rect = Bounds();
80 bar =
new BStatusBar(
rect,
"progress",
82 bar->SetMaxValue(dlsize);
86 BView* back =
new BView(Bounds(),
"back", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
87 back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
94 BRect size =
bar->Bounds();
95 ResizeTo(size.Width() + 6, size.Height() + 6);
110 switch(message->what)
112 case B_SAVE_REQUESTED:
119 message->FindRef(
"directory", &
directory);
120 message->FindString(
"name", &
name);
121 message->FindPointer(
"dw", (
void**)&dw);
125 B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE);
128 BMallocIO* tempstore =
dynamic_cast<BMallocIO*
>(dw->
storage);
130 storage->Write(tempstore->Buffer(), tempstore->BufferLength());
139 message->FindPointer(
"source", (
void**)&source);
145 BWindow::MessageReceived(message);
190 if (download == NULL)
193 download->
storageLock =
new BLocker(
"storage_lock");
194 download->
storage =
new BMallocIO();
200 BMessage* msg =
new BMessage(B_SAVE_REQUESTED);
202 BFilePanel* panel =
new BFilePanel(B_SAVE_PANEL,
203 new BMessenger(download->
window), NULL, 0,
false);
207 msg->AddPointer(
"source", panel);
208 msg->AddPointer(
"dw", download);
209 panel->SetMessage(msg);
218 const char *data,
unsigned int size)
231 const char *error_msg)
static osspriteop_area * buffer
The buffer characteristics.
void MessageReceived(BMessage *message)
NSDownloadWindow(download_context *ctx)
void Failure(const char *error)
void download_context_destroy(download_context *ctx)
Destroy a download context.
const char * download_context_get_filename(const download_context *ctx)
Retrieve the filename for a download.
void download_context_abort(download_context *ctx)
Abort a download fetch.
unsigned long long int download_context_get_total_length(const download_context *ctx)
Retrieve total byte length of download.
Core download context (interface)
struct gui_download_table * beos_download_table
static struct gui_download_table download_table
static nserror gui_download_window_data(struct gui_download_window *dw, const char *data, unsigned int size)
static void gui_download_window_error(struct gui_download_window *dw, const char *error_msg)
static void gui_download_window_done(struct gui_download_window *dw)
static struct gui_download_window * gui_download_window_create(download_context *ctx, struct gui_window *parent)
nserror
Enumeration of error codes.
Interface to platform-specific download operations.
Interface to utility string handling.
char * human_friendly_bytesize(unsigned long long int bytesize)
Create a human readable representation of a size in bytes.
A context for a download.
function table for download windows.
context for each download.
os_fw file
RISC OS file handle, of temporary file when !saved, and of destination when saved.
download_context * ctx
Associated context, or 0 if the fetch has completed or aborted.
struct download_context * ctx
Associated context, or 0 if the fetch has completed or aborted.
NSDownloadWindow * window
first entry in window list
Interface to a number of general purpose functionality.