Implemented app_server-related global functions

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2945 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2003-03-19 00:49:48 +00:00
parent 2465c76947
commit eae2f2f089
2 changed files with 377 additions and 0 deletions

View File

@ -0,0 +1,376 @@
//------------------------------------------------------------------------------
// Copyright (c) 2001-2002, OpenBeOS
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// File Name: Globals.cpp
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Description: Global functions and variables for the Interface Kit
//
//------------------------------------------------------------------------------
#include <PortLink.h>
#include <InterfaceDefs.h>
#include <GraphicsDefs.h>
#include <ServerProtocol.h>
#include <AppServerLink.h>
// Private definitions not placed in public headers
extern "C" void _init_global_fonts();
extern "C" status_t _fini_interface_kit_();
// InterfaceDefs.h
_IMPEXP_BE const color_map *system_colors()
{
// Gets the color map via the BScreen class
// TODO: Implement
}
_IMPEXP_BE status_t set_screen_space(int32 index, uint32 res, bool stick = true)
{
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_SET_SCREEN_MODE);
link->portlink->Attach(index);
link->portlink->Attach((int32)res);
link->portlink->Attach(stick);
link->portlink->Flush();
delete link;
}
_IMPEXP_BE status_t get_scroll_bar_info(scroll_bar_info *info)
{
// Contacts the app_server
// TODO: Implement
// AS_GET_SCROLLBAR_INFO,
}
_IMPEXP_BE status_t set_scroll_bar_info(scroll_bar_info *info)
{
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_SET_SCROLLBAR_INFO);
link->portlink->Attach(info, sizeof(scroll_bar_info));
link->portlink->Flush();
delete link;
}
_IMPEXP_BE status_t get_mouse_type(int32 *type)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t set_mouse_type(int32 type)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t get_mouse_map(mouse_map *map)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t set_mouse_map(mouse_map *map)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t get_click_speed(bigtime_t *speed)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t set_click_speed(bigtime_t speed)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t get_mouse_speed(int32 *speed)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t set_mouse_speed(int32 speed)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t get_mouse_acceleration(int32 *speed)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t set_mouse_acceleration(int32 speed)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t get_key_repeat_rate(int32 *rate)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t set_key_repeat_rate(int32 rate)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t get_key_repeat_delay(bigtime_t *delay)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t set_key_repeat_delay(bigtime_t delay)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE uint32 modifiers()
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t get_key_info(key_info *info)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE void get_key_map(key_map **map, char **key_buffer)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE status_t get_keyboard_id(uint16 *id)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE void set_modifier_key(uint32 modifier, uint32 key)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE void set_keyboard_locks(uint32 modifiers)
{
// Contacts the input_server via _control_input_server_(BMessage *, BMessage *)
// TODO: Implement
}
_IMPEXP_BE rgb_color keyboard_navigation_color()
{
// Queries the app_server
// TODO: Implement
return ui_color(B_KEYBOARD_NAVIGATION_COLOR);
}
_IMPEXP_BE int32 count_workspaces()
{
PortLink::ReplyData replydata;
int32 count;
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_COUNT_WORKSPACES);
link->portlink->FlushWithReply(&replydata);
count=*((int32*)replydata.buffer);
delete link;
return count;
}
_IMPEXP_BE void set_workspace_count(int32 count)
{
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_SET_WORKSPACE_COUNT);
link->portlink->Attach(count);
link->portlink->Flush();
delete link;
}
_IMPEXP_BE int32 current_workspace()
{
PortLink::ReplyData replydata;
int32 index;
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_CURRENT_WORKSPACE);
link->portlink->FlushWithReply(&replydata);
index=*((int32*)replydata.buffer);
delete link;
return index;
}
_IMPEXP_BE void activate_workspace(int32 workspace)
{
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_ACTIVATE_WORKSPACE);
link->portlink->Attach(workspace);
link->portlink->Flush();
delete link;
}
_IMPEXP_BE bigtime_t idle_time()
{
PortLink::ReplyData replydata;
bigtime_t idletime;
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_IDLE_TIME);
link->portlink->FlushWithReply(&replydata);
idletime=*((bigtime_t*)replydata.buffer);
delete link;
return idletime;
}
_IMPEXP_BE void run_select_printer_panel()
{
// Launches the Printer prefs app via the Roster
// TODO: Implement
}
_IMPEXP_BE void run_add_printer_panel()
{
// Launches the Printer prefs app via the Roster and asks it to
// add a printer
// TODO: Implement
}
_IMPEXP_BE void run_be_about()
{
// Unsure about how to implement this.
// TODO: Implement
}
_IMPEXP_BE void set_focus_follows_mouse(bool follow)
{
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_SET_FOCUS_FOLLOWS_MOUSE);
link->portlink->Attach(follow);
link->portlink->Flush();
delete link;
}
_IMPEXP_BE bool focus_follows_mouse()
{
}
_IMPEXP_BE void set_mouse_mode(mode_mouse mode)
{
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_SET_MOUSE_MODE);
link->portlink->Attach((int32)mode);
link->portlink->Flush();
delete link;
}
_IMPEXP_BE mode_mouse mouse_mode()
{
PortLink::ReplyData replydata;
mode_mouse mode;
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_GET_MOUSE_MODE);
link->portlink->FlushWithReply(&replydata);
mode=*((mode_mouse*)replydata.buffer);
delete link;
return mode;
}
_IMPEXP_BE rgb_color ui_color(color_which which)
{
PortLink::ReplyData replydata;
rgb_color color;
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
link->Init();
link->portlink->SetOpCode(AS_GET_UI_COLOR);
link->portlink->FlushWithReply(&replydata);
color=*((rgb_color*)replydata.buffer);
delete link;
return color;
}
_IMPEXP_BE rgb_color tint_color(rgb_color color, float tint)
{
// Internally calculates the color
// TODO: Implement
}
extern "C" status_t _init_interface_kit_()
{
// TODO: Find out what this does and when it's called
}
extern "C" status_t _fini_interface_kit_()
{
// TODO: Find out what this does and when it's called
}
extern "C" void _init_global_fonts()
{
// This function will initialize the client-side font list
// TODO: Implement
}
// GraphicsDefs.h
_IMPEXP_BE status_t get_pixel_size_for(color_space space, size_t * pixel_chunk, size_t * row_alignment, size_t * pixels_per_chunk)
{
// TODO: Implement
}
_IMPEXP_BE bool bitmaps_support_space(color_space space, uint32 * support_flags)
{
// TODO: Implement
}

View File

@ -8,6 +8,7 @@ INTERFACE_KIT_SOURCE =
Control.cpp Control.cpp
Deskbar.cpp Deskbar.cpp
Font.cpp Font.cpp
Globals.cpp
Picture.cpp Picture.cpp
PictureButton.cpp PictureButton.cpp
Point.cpp Point.cpp