Commit 01b7e3c1 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

mac common

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@64488 954022d7-b5bf-4e40-9824-e11837661b57
parent 293e4ff6
#include "./filedownloader.h"
#include <Cocoa/Cocoa.h>
static NSString* StringWToNSString ( const std::wstring& Str )
{
NSString* pString = [ [ NSString alloc ]
initWithBytes : (char*)Str.data()
length : Str.size() * sizeof(wchar_t)
encoding : CFStringConvertEncodingToNSStringEncoding ( kCFStringEncodingUTF32LE ) ];
return pString;
}
int CFileDownloader::DownloadFileAll(std::wstring sFileURL)
{
NSString* stringURL = StringWToNSString(sFileURL);
NSURL *url = [NSURL URLWithString:stringURL];
NSData *urlData = [NSData dataWithContentsOfURL:url];
if ( urlData )
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = StringWToNSString ( m_sFilePath );
[urlData writeToFile:filePath atomically:YES];
return 1;
}
return 0;
}
#ifndef CEF_MAC_COMMON_H
#define CEF_MAC_COMMON_H
#include "../include/base.h"
void MAC_COMMON_set_window_handle_sizes(WindowHandleId handle,
int x, int y, int w, int h);
#endif // CEF_MAC_COMMON_H
#include <Cocoa/Cocoa.h>
#include "mac_common.h"
void MAC_COMMON_set_window_handle_sizes(WindowHandleId handle,
int x, int y, int w, int h)
{
NSView* view = (NSView*)handle;
NSRect f = view.frame;
f.origin.x = x;
f.origin.y = y;
f.size.width = w;
f.size.height = h;
view.frame = f;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment