bcc32: add example boxlib_1
git-svn-id: svn://kolibrios.org@8325 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
14860dd83d
commit
505e8a9d21
19
programs/bcc32/examples/boxlib_1/Makefile
Normal file
19
programs/bcc32/examples/boxlib_1/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
# Path to /programs
|
||||
SVN_PROGR:=../../..
|
||||
|
||||
# Path to /programs/bcc32
|
||||
SVN_BCC32:=$(SVN_PROGR)/bcc32
|
||||
|
||||
# Path to t2fasm
|
||||
T2FASM:=$(SVN_BCC32)/t2fasm
|
||||
|
||||
# Path to include
|
||||
INCLUDE:=$(SVN_BCC32)/include
|
||||
|
||||
# Path to Bin folder
|
||||
KOS32_BCC:=/home/autobuild/borlandcpp/bin
|
||||
|
||||
# Filename without .cpp
|
||||
FILENAME:=boxlib_1
|
||||
|
||||
include $(SVN_BCC32)/Makefile_app
|
78
programs/bcc32/examples/boxlib_1/boxlib_1.cpp
Normal file
78
programs/bcc32/examples/boxlib_1/boxlib_1.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
#include <kolibri.h>
|
||||
#include <kos_heap.h>
|
||||
#include <load_lib.h>
|
||||
#include <l_box_lib.h>
|
||||
|
||||
using namespace Kolibri;
|
||||
|
||||
const char header[] = "Boxlib example 1";
|
||||
char library_path[2048];
|
||||
|
||||
void* mouse_dd;
|
||||
char str1[22];
|
||||
char str2[22];
|
||||
char str3[22] = "+380";
|
||||
|
||||
edit_box edit1 = { 100, 62, 10, 0xffffff, 0xa0a0a0, 0xff, 0, 0, 20, str1, &mouse_dd, ed_focus };
|
||||
edit_box edit2 = { 100, 62, 30, 0xffffff, 0xa0a0a0, 0xff, 0, 0, 20, str2, &mouse_dd };
|
||||
edit_box edit3 = { 100, 62, 50, 0xffffff, 0xa0a0a0, 0xff, 0, 0, 20, str3, &mouse_dd, 0, 4 };
|
||||
|
||||
char str4[] = "CheckBox 1";
|
||||
char str5[] = "CheckBox 2";
|
||||
|
||||
check_box check1 = { {15, 10, 12, 80}, 8, 0xffffff, 0x80, 0, str4, ch_flag_middle+ch_flag_en };
|
||||
check_box check2 = { {15, 10, 20, 100}, 8, 0xffffff, 0x80, 0, str5, ch_flag_middle };
|
||||
|
||||
namespace Kolibri{
|
||||
char CurrentDirectoryPath[2048];
|
||||
}
|
||||
|
||||
bool KolibriOnStart(TStartData &kos_start, TThreadData /*th*/)
|
||||
{
|
||||
kos_start.Left = 10;
|
||||
kos_start.Top = 40;
|
||||
kos_start.Width = 280;
|
||||
kos_start.Height = 200;
|
||||
kos_start.WinData.WindowColor = 0xd0d0d0;
|
||||
kos_start.WinData.WindowType = 0x33; // 0x34 - fixed, 0x33 - not fixed
|
||||
kos_start.WinData.Title = header;
|
||||
if(LoadLibrary("box_lib.obj", library_path, "/sys/lib/box_lib.obj", &import_box_lib))
|
||||
{
|
||||
check_box_init(&check1);
|
||||
check_box_init(&check2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void KolibriOnPaint(void)
|
||||
{
|
||||
DrawText(10,14,0,"Surname:");
|
||||
edit_box_draw(&edit1);
|
||||
DrawText(10,34,0,"Name:");
|
||||
edit_box_draw(&edit2);
|
||||
DrawText(10,54,0,"Phone:");
|
||||
edit_box_draw(&edit3);
|
||||
|
||||
check_box_draw(&check1);
|
||||
check_box_draw(&check2);
|
||||
}
|
||||
|
||||
void KolibriOnKeyPress(TThreadData th)
|
||||
{
|
||||
asm{
|
||||
mcall SF_GET_KEY
|
||||
}
|
||||
edit_box_key(&edit1);
|
||||
edit_box_key(&edit2);
|
||||
edit_box_key(&edit3);
|
||||
}
|
||||
|
||||
void KolibriOnMouse(TThreadData th)
|
||||
{
|
||||
edit_box_mouse(&edit1);
|
||||
edit_box_mouse(&edit2);
|
||||
edit_box_mouse(&edit3);
|
||||
|
||||
check_box_mouse(&check1);
|
||||
check_box_mouse(&check2);
|
||||
}
|
15
programs/bcc32/examples/boxlib_1/boxlib_1_cpp.bat
Normal file
15
programs/bcc32/examples/boxlib_1/boxlib_1_cpp.bat
Normal file
@ -0,0 +1,15 @@
|
||||
Set NAME=boxlib_1
|
||||
Set BCC_DIR=..\..\..\bcc32
|
||||
kos32-bcc -S -v- -R- -6 -a4 -O2 -Og -Oi -Ov -OS -k- -D__KOLIBRI__ -I..\..\..\bcc32\include %NAME%.cpp
|
||||
|
||||
echo STACKSIZE equ 8192> kos_make.inc
|
||||
echo include "%BCC_DIR%\include\kos_start.inc">> kos_make.inc
|
||||
echo include "%BCC_DIR%\include\kos_func.inc">> kos_make.inc
|
||||
echo include "%BCC_DIR%\include\kos_heap.inc">> kos_make.inc
|
||||
|
||||
echo include "kos_make.inc" > f_%NAME%.asm
|
||||
t2fasm < %NAME%.asm >> f_%NAME%.asm
|
||||
fasm f_%NAME%.asm %NAME%.kex
|
||||
if exist %NAME%.kex kpack %NAME%.kex
|
||||
if exist %NAME%.kex del kos_make.inc
|
||||
pause
|
191
programs/bcc32/include/l_box_lib.h
Normal file
191
programs/bcc32/include/l_box_lib.h
Normal file
@ -0,0 +1,191 @@
|
||||
#ifndef __L_BOX_LIB_H_INCLUDED_
|
||||
#define __L_BOX_LIB_H_INCLUDED_
|
||||
//
|
||||
// box_lib.obj
|
||||
//
|
||||
|
||||
const long ed_pass = 1; //password mode
|
||||
const long ed_focus = 2; //active
|
||||
const long ed_shift = 4; //shift holded
|
||||
const long ed_shift_on = 8; //selection active
|
||||
const long ed_shift_bac = 16; //clear selection
|
||||
const long ed_left_fl = 32;
|
||||
const long ed_offset_fl = 64;
|
||||
const long ed_insert = 128;
|
||||
const long ed_mouse_on = 256;
|
||||
const long ed_ctrl_on = 512;
|
||||
const long ed_alt_on = 0x400;
|
||||
const long ed_disabled = 0x800;
|
||||
const long ed_always_focus = 0x4000;
|
||||
const long ed_figure_only = 0x8000;
|
||||
const long ed_mous_adn_b = ed_mouse_on | ed_shift_on | ed_shift_bac;
|
||||
const long ed_shift_off = ! ed_shift;
|
||||
const long ed_shift_mcl = ! ed_shift;
|
||||
const long ed_shift_on_off = ! ed_shift_on;
|
||||
const long ed_shift_bac_cl = ! ed_shift_bac;
|
||||
const long ed_shift_cl = ! (ed_shift | ed_shift_on | ed_shift_bac);
|
||||
const long ed_right_fl = ! ed_left_fl;
|
||||
const long ed_offset_cl = ! ed_offset_fl;
|
||||
const long ed_insert_cl = ! ed_insert;
|
||||
const long ed_mouse_on_off = ! ed_mouse_on;
|
||||
const long ed_ctrl_off = ! ed_ctrl_on;
|
||||
const long ed_alt_off = ! ed_alt_on;
|
||||
|
||||
struct edit_box
|
||||
{
|
||||
long width;
|
||||
long left;
|
||||
long top;
|
||||
long color;
|
||||
long shift_color;
|
||||
long focus_border_color;
|
||||
long blur_border_color;
|
||||
long text_color;
|
||||
long max;
|
||||
char* text;
|
||||
void* mouse_variable;
|
||||
long flags;
|
||||
long size;
|
||||
long pos;
|
||||
long offset;
|
||||
short int cl_curs[2]; // x, y
|
||||
short int shift[2];
|
||||
long height;
|
||||
long char_width;
|
||||
};
|
||||
|
||||
const long ch_flag_en = 2;
|
||||
const long ch_flag_top = 0;
|
||||
const long ch_flag_middle = 4;
|
||||
const long ch_flag_bottom = 8;
|
||||
|
||||
struct check_box
|
||||
{
|
||||
short int rect[4]; // width, left, height, top
|
||||
long text_margin;
|
||||
long color;
|
||||
long border_color;
|
||||
long text_color;
|
||||
char* text;
|
||||
long flags;
|
||||
long size_of_str;
|
||||
};
|
||||
|
||||
//
|
||||
// box_lib - import table
|
||||
//
|
||||
void (__stdcall* import_box_lib)() = (void (__stdcall*)())&"lib_init";
|
||||
//&"version";
|
||||
|
||||
void (__stdcall* edit_box_draw)(edit_box* edit) = (void (__stdcall*)(edit_box*))&"edit_box";
|
||||
void (__stdcall* edit_box_key)(edit_box* edit) = (void (__stdcall*)(edit_box*))&"edit_box_key";
|
||||
void (__stdcall* edit_box_mouse)(edit_box* edit) = (void (__stdcall*)(edit_box*))&"edit_box_mouse";
|
||||
void (__stdcall* edit_box_set_text)(edit_box* edit, char* text) = (void (__stdcall*)(edit_box*, char*))&"edit_box_set_text";
|
||||
//&"version_ed";
|
||||
|
||||
void (__stdcall* check_box_init)(check_box* check) = (void (__stdcall*)(check_box*))&"init_checkbox2";
|
||||
void (__stdcall* check_box_draw)(check_box* check) = (void (__stdcall*)(check_box*))&"check_box_draw2";
|
||||
void (__stdcall* check_box_mouse)(check_box* check) = (void (__stdcall*)(check_box*))&"check_box_mouse2";
|
||||
//&"version_ch2";
|
||||
|
||||
//void (__stdcall* option_box_draw)(...) = (void (__stdcall*)(...))&"option_box_draw";
|
||||
//void (__stdcall* option_box_mouse)(...) = (void (__stdcall*)(...))&"option_box_mouse";
|
||||
//&"version_op";
|
||||
|
||||
//void (__stdcall* scrollbar_v_draw)(...) = (void (__stdcall*)(...))&"scrollbar_v_draw";
|
||||
//void (__stdcall* scrollbar_v_mouse)(...) = (void (__stdcall*)(...))&"scrollbar_v_mouse";
|
||||
//void (__stdcall* scrollbar_h_draw)(...) = (void (__stdcall*)(...))&"scrollbar_h_draw";
|
||||
//void (__stdcall* scrollbar_h_mouse)(...) = (void (__stdcall*)(...))&"scrollbar_h_mouse";
|
||||
//&"version_scrollbar";
|
||||
|
||||
//void (__stdcall* dbutton_draw)(...) = (void (__stdcall*)(...))&"dbutton_draw";
|
||||
//void (__stdcall* dbutton_mouse)(...) = (void (__stdcall*)(...))&"dbutton_mouse";
|
||||
//&"version_dbutton";
|
||||
|
||||
//void (__stdcall* menu_bar_draw)(...) = (void (__stdcall*)(...))&"menu_bar_draw";
|
||||
//void (__stdcall* menu_bar_mouse)(...) = (void (__stdcall*)(...))&"menu_bar_mouse";
|
||||
//void (__stdcall* menu_bar_activate)(...) = (void (__stdcall*)(...))&"menu_bar_activate";
|
||||
//&"version_menu_bar";
|
||||
|
||||
//void (__stdcall* FileBrowser_draw)(...) = (void (__stdcall*)(...))&"FileBrowser_draw";
|
||||
//void (__stdcall* FileBrowser_mouse)(...) = (void (__stdcall*)(...))&"FileBrowser_mouse";
|
||||
//void (__stdcall* FileBrowser_key)(...) = (void (__stdcall*)(...))&"FileBrowser_key";
|
||||
//&"version_FileBrowser";
|
||||
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_data_init";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_data_clear";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_info_clear";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_key";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_mouse";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_draw";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_info_undo";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_info_redo";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_add";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_set_data";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_get_data";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_delete";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_cur_beg";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_cur_next";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_cur_perv";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_close_open";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_lev_inc";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_lev_dec";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_move_up";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_move_down";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_poi_get_info";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_poi_get_next_info";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_node_poi_get_data";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_save_mem";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_load_mem";
|
||||
//void (__stdcall* ...)(...) = (void (__stdcall*)(...))&"tl_get_mem_size";
|
||||
//&"version_tree_list";
|
||||
|
||||
//void (__stdcall* PathShow_prepare)(...) = (void (__stdcall*)(...))&"PathShow_prepare";
|
||||
//void (__stdcall* PathShow_draw)(...) = (void (__stdcall*)(...))&"PathShow_draw";
|
||||
//&"version_PathShow";
|
||||
|
||||
//void (__stdcall* ted_but_sumb_upper)(...) = (void (__stdcall*)(...))&"ted_but_sumb_upper";
|
||||
//void (__stdcall* ted_but_sumb_lover)(...) = (void (__stdcall*)(...))&"ted_but_sumb_lover";
|
||||
//void (__stdcall* ted_but_convert_by_table)(...) = (void (__stdcall*)(...))&"ted_but_convert_by_table";
|
||||
//void (__stdcall* ted_can_save)(...) = (void (__stdcall*)(...))&"ted_can_save";
|
||||
//void (__stdcall* ted_clear)(...) = (void (__stdcall*)(...))&"ted_clear";
|
||||
//void (__stdcall* ted_delete)(...) = (void (__stdcall*)(...))&"ted_delete";
|
||||
//void (__stdcall* ted_draw)(...) = (void (__stdcall*)(...))&"ted_draw";
|
||||
//void (__stdcall* ted_init)(...) = (void (__stdcall*)(...))&"ted_init";
|
||||
//void (__stdcall* ted_init_scroll_bars)(...) = (void (__stdcall*)(...))&"ted_init_scroll_bars";
|
||||
//void (__stdcall* ted_init_syntax_file)(...) = (void (__stdcall*)(...))&"ted_init_syntax_file";
|
||||
//void (__stdcall* ted_is_select)(...) = (void (__stdcall*)(...))&"ted_is_select";
|
||||
//void (__stdcall* ted_key)(...) = (void (__stdcall*)(...))&"ted_key";
|
||||
//void (__stdcall* ted_mouse)(...) = (void (__stdcall*)(...))&"ted_mouse";
|
||||
//void (__stdcall* ted_open_file)(...) = (void (__stdcall*)(...))&"ted_open_file";
|
||||
//void (__stdcall* ted_save_file)(...) = (void (__stdcall*)(...))&"ted_save_file";
|
||||
//void (__stdcall* ted_text_add)(...) = (void (__stdcall*)(...))&"ted_text_add";
|
||||
//void (__stdcall* ted_but_select_word)(...) = (void (__stdcall*)(...))&"ted_but_select_word";
|
||||
//void (__stdcall* ted_but_cut)(...) = (void (__stdcall*)(...))&"ted_but_cut";
|
||||
//void (__stdcall* ted_but_copy)(...) = (void (__stdcall*)(...))&"ted_but_copy";
|
||||
//void (__stdcall* ted_but_paste)(...) = (void (__stdcall*)(...))&"ted_but_paste";
|
||||
//void (__stdcall* ted_but_undo)(...) = (void (__stdcall*)(...))&"ted_but_undo";
|
||||
//void (__stdcall* ted_but_redo)(...) = (void (__stdcall*)(...))&"ted_but_redo";
|
||||
//void (__stdcall* ted_but_reverse)(...) = (void (__stdcall*)(...))&"ted_but_reverse";
|
||||
//void (__stdcall* ted_but_find)(...) = (void (__stdcall*)(...))&"ted_but_find";
|
||||
//void (__stdcall* ted_but_replace)(...) = (void (__stdcall*)(...))&"ted_but_replace";
|
||||
//void (__stdcall* ted_text_colored)(...) = (void (__stdcall*)(...))&"ted_text_colored";
|
||||
//void (__stdcall* ted_go_to_position)(...) = (void (__stdcall*)(...))&"ted_go_to_position";
|
||||
//&"version_text_edit";
|
||||
|
||||
//void (__stdcall* frame_draw)(...) = (void (__stdcall*)(...))&"frame_draw";
|
||||
//&"version_frame";
|
||||
|
||||
//void (__stdcall* progressbar_draw)(...) = (void (__stdcall*)(...))&"progressbar_draw";
|
||||
//void (__stdcall* progressbar_progress)(...) = (void (__stdcall*)(...))&"progressbar_progress";
|
||||
|
||||
//void (__stdcall* tooltip_init)(...) = (void (__stdcall*)(...))&"tooltip_init";
|
||||
//void (__stdcall* tooltip_delete)(...) = (void (__stdcall*)(...))&"tooltip_delete";
|
||||
//void (__stdcall* tooltip_test_show)(...) = (void (__stdcall*)(...))&"tooltip_test_show";
|
||||
//void (__stdcall* tooltip_mouse)(...) = (void (__stdcall*)(...))&"tooltip_mouse";
|
||||
//void (__stdcall* get_font_size)(...) = (void (__stdcall*)(...))&"get_font_size";
|
||||
asm{
|
||||
dd 0,0
|
||||
}
|
||||
|
||||
#endif
|
@ -7,7 +7,7 @@ asm{
|
||||
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
}
|
||||
|
||||
bool LoadLibrary(const char* lib_name, char* lib_path, const char* system_path, void* myimport)
|
||||
bool LoadLibrary(const char* /*lib_name*/, char* /*lib_path*/, const char* /*system_path*/, void* /*myimport*/)
|
||||
{
|
||||
asm{
|
||||
load_library [ebp+8], [ebp+12], [ebp+16], [ebp+20]
|
||||
|
Loading…
Reference in New Issue
Block a user