update bindgen

This commit is contained in:
csmoe committed 2024-11-16 14:29:48 +08:00
1 parent cc78c771e5
commit 63321caf54
17 files changed
+575 -91

No files matched your search

+3 -3
View File
@@ -3,9 +3,9 @@ name = "cef"
version = "130.1.16"
edition = "2021"
license = "Apache-2.0 OR MIT"
authors = ["Wu Yu Wei <yuweiwu@pm.me>"]
authors = ["Wu Yu Wei <yuweiwu@pm.me>", "csmoe <csmoe@msn.com>"]
description = "Use cef in Rust"
repository = "https://github.com/wusyong/cef-rs"
repository = "https://github.com/csmoe/cef-rs"
readme = "README.md"
[package.metadata.bundle.example.demo]
@@ -14,7 +14,7 @@ identifier = "com.cef.demo"
category = "Utility"
short_description = "An example of a bundled CEF application"
long_description = """ CEF application in Rust """
osx_frameworks = [ "/Users/mac/Downloads/cef/Release/Chromium Embedded Framework.framework" ]
osx_frameworks = [ "sys/cef/archive/Release/Chromium Embedded Framework.framework" ]
[features]
dox = ["cef-sys/dox"]
+8 -10
View File
@@ -6,8 +6,8 @@ Use CEF in Rust.
| Target | Linux | macOS | Windows |
| ------ | ----- | ----- | ------- |
| x86_64 | ✅ | ❎ | ❎ |
| ARM64 | ✅ | ❎ | ❎ |
| x86_64 | ✅ | ✅ | ✅ |
| ARM64 | ✅ | ✅ | ✅ |
## Usage
@@ -15,19 +15,17 @@ Use CEF in Rust.
#### Manual Install
- [Download](https://cef-builds.spotifycdn.com/index.html#linux64) Linux-64bit build.
- Download Linux-64bit prebuilt with `sys/upgrade.rs`:
- Copy files to `.local`:
```
cp -r Resources ~/.local/share/cef
cp -r Release ~/.local/share/cef
```sh
cd sys
./upgrade.rs x86_64-unknown-linux-gnu --download
```
- Build and run the application with `LD_LIBRARY_PATH` (or you can also add rpath to your cargo config or build script):
```
LD_LIBRARY_PATH=~/.local/share/cef cargo r --example demo
```sh
LD_LIBRARY_PATH=sys/cef/archive cargo r --example demo
```
#### Flatpak
+1 -1
View File
@@ -52,7 +52,7 @@ fn main() {
let url = CefString::new("https://www.google.com");
let browser_view =
cef::create_browser_view(Some(client), &url, browser_settings.clone(), null_mut()).unwrap();
cef::create_browser_view(Some(client), &url, browser_settings.clone()).unwrap();
let delegate = DemoWindow { browser_view };
cef::create_top_level_window(delegate);
+2 -8
View File
@@ -1,14 +1,8 @@
use std::{ffi::c_int, ptr::null_mut};
use cef_sys::{
cef_browser_host_create_browser, cef_browser_settings_t, cef_browser_view_create,
cef_browser_view_t,
};
use cef_sys::{cef_browser_host_create_browser, cef_browser_settings_t};
use crate::{
client::Client, error::Error, error::Result, rc::RefGuard, string::CefString,
window::WindowInfo, wrapper, State, View,
};
use crate::{client::Client, string::CefString, view::WindowInfo, State};
/// See [cef_browser_settings_t] for more documentation.
#[derive(Debug, Clone)]
+1 -1
View File
@@ -1,6 +1,6 @@
use cef_sys::cef_command_line_t;
use crate::{rc::RefGuard, wrapper};
use crate::wrapper;
wrapper!(
#[doc = "See [cef_command_line_t] for more documentation."]
-2
View File
@@ -10,7 +10,6 @@ pub mod rc;
mod settings;
pub mod string;
mod view;
mod window;
pub use cef_sys as sys;
@@ -19,7 +18,6 @@ pub use browser::*;
pub use command_line::*;
pub use settings::*;
pub use view::*;
pub use window::*;
pub type LogSeverity = cef_sys::cef_log_severity_t;
pub type LogItems = cef_sys::cef_log_items_t;
+1 -3
View File
@@ -148,7 +148,7 @@ macro_rules! gen_fn {
macro_rules! wrapper {
(
$(#[$attr:meta])*
pub struct $name:ident($sys:ident);
pub struct $name:ident($sys:path);
$($visibility:vis fn $method:ident(
&self
$(,$arg:ident: [$ref:ident] $type:ty)*)
@@ -186,8 +186,6 @@ macro_rules! wrapper {
}
};
}
pub use gen_fn;
pub use wrapper;
/// A smart pointer for types from cef library.
#[derive(Debug)]
+17 -14
View File
@@ -13,24 +13,20 @@ mod button;
pub use button::*;
mod browser;
pub use browser::*;
mod window;
pub use window::*;
wrapper!(
#[doc = "See [cef_view_t] for more documentation."]
#[derive(Debug, Clone)]
pub struct View(cef_view_t);
);
macro_rules! impl_from_view {
($( ($as_field:ident, $target_type:ident) ),*) => {
macro_rules! convert_view {
($( ($view:ident, $as_field:ident, $target_type:ident) ),*) => {
$(
impl From<$crate::view::View> for Option<$crate::$target_type> {
fn from(value: $crate::view::View) -> Self {
impl From<$view> for Option<$crate::$target_type> {
fn from(value: $view) -> Self {
value.0.$as_field.and_then(|f| {
let v = unsafe { f(value.0.get_raw()) };
if v.is_null() {
None
} else {
Some($crate::$target_type(unsafe { $crate::rc::RefGuard::from_raw(v) }))
Some($crate::view::$target_type(unsafe { $crate::rc::RefGuard::from_raw(v) }))
}
})
}
@@ -38,12 +34,19 @@ macro_rules! impl_from_view {
)*
};
}
pub(crate) use convert_view;
impl_from_view! {
(as_browser_view, BrowserView),
(as_panel, Panel)
convert_view! {
(View, as_browser_view, BrowserView),
(View, as_panel, Panel)
}
wrapper!(
#[doc = "See [cef_view_t] for more documentation."]
#[derive(Debug, Clone)]
pub struct View(cef_view_t);
);
/// See [cef_view_delegate_t] for more documentation.
pub trait ViewDelegate: Sized {
fn on_parent_view_changed(&self, _view: View, _added: bool, _parent: View) {}
+1 -1
View File
@@ -25,7 +25,7 @@ pub fn create_browser_view<T: Client>(
client: Option<T>,
url: &CefString,
settings: BrowserSettings,
delegate: cef_sys::cef_browser_view_delegate_t,
//delegate: cef_sys::cef_browser_view_delegate_t,
) -> Result<BrowserView> {
let client = client.map(|c| c.into_raw()).unwrap_or(null_mut());
+15 -6
View File
@@ -1,13 +1,22 @@
use cef_sys::{cef_button_t, cef_label_button_t};
crate::wrapper!(
#[doc = "See [cef_button_t] for more documentation."]
#[doc = "See `[cef_sys::cef_button_t]` for more documentation."]
#[derive(Debug, Clone)]
pub struct Button(cef_button_t);
pub struct Button(cef_sys::cef_button_t);
);
crate::wrapper!(
#[doc = "See [cef_label_button_t] for more documentation."]
#[doc = "See `[cef_sys::cef_label_button_t]` for more documentation."]
#[derive(Debug, Clone)]
pub struct LabelButton(cef_label_button_t);
pub struct LabelButton(cef_sys::cef_label_button_t);
);
crate::wrapper!(
#[doc = "See `[cef_sys::cef_menu_button_t]` for more documentation."]
#[derive(Debug, Clone)]
pub struct MenuButton(cef_sys::cef_menu_button_t);
);
crate::convert_view! {
(Button, as_label_button, LabelButton),
(LabelButton, as_menu_button, MenuButton)
}
+5 -6
View File
@@ -1,11 +1,6 @@
use cef_sys::{cef_panel_delegate_t, cef_panel_t};
use crate::{
add_view_delegate_methods,
rc::{RcImpl, RefGuard},
view::View,
wrapper, ViewDelegate, Window,
};
use crate::{add_view_delegate_methods, view::View, wrapper, ViewDelegate, Window};
wrapper!(
#[doc = "See [cef_panel_t] for more documentation."]
@@ -13,6 +8,10 @@ wrapper!(
pub struct Panel(cef_panel_t);
);
crate::convert_view! {
(Panel, as_window, Window)
}
impl Panel {
pub fn add_child_view(&self, view: View) {
if let Some(f) = self.0.add_child_view {
+1 -1
View File
@@ -6,9 +6,9 @@ use windows::Win32::UI::WindowsAndMessaging::HMENU;
use crate::{
add_view_delegate_methods,
view::{Panel, PanelDelegate},
rc::{RcImpl, RefGuard},
string::CefString,
view::{Panel, PanelDelegate},
wrapper, Rect,
};
+1 -1
View File
@@ -3,7 +3,7 @@ name = "libcef-sys"
version = "130.1.16"
edition = "2021"
license = "Apache-2.0 OR MIT"
authors = ["Wu Yu Wei <yuweiwu@pm.me>", "csmoe@msn.com" ]
authors = ["Wu Yu Wei <yuweiwu@pm.me>", "csmoe <csmoe@msn.com>" ]
description = "cef-rs sys crate"
repository = "https://github.com/csmoe/cef-rs"
build = "build.rs"
+1 -1
View File
@@ -2,7 +2,7 @@ fn main() {
let cef_path = std::env::var("CEF_PATH")
.map(std::path::PathBuf::from)
.unwrap();
let cef_link_path = cef_path.join("Release");
let cef_link_path = cef_path;
build::rerun_if_changed("build.rs");
match build::cargo_cfg_target_os().as_str() {
+474 -30
View File
@@ -13559,16 +13559,6 @@ const _: () = {
};
#[doc = "\n Implement this structure to handle BrowserView events. The functions of this\n structure will be called on the browser process UI thread unless otherwise\n indicated.\n"]
pub type cef_browser_view_delegate_t = _cef_browser_view_delegate_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_scroll_view_t {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_textfield_t {
_unused: [u8; 0],
}
#[doc = "\n A View is a rectangle within the views View hierarchy. It is the base\n structure for all Views. All size and position values are in density\n independent pixels (DIP) unless otherwise indicated. Methods must be called\n on the browser process UI thread unless otherwise indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@@ -14210,21 +14200,6 @@ const _: () = {
};
#[doc = "\n Implement this structure to handle Panel events. The functions of this\n structure will be called on the browser process UI thread unless otherwise\n indicated.\n"]
pub type cef_panel_delegate_t = _cef_panel_delegate_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_box_layout_t {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_fill_layout_t {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_layout_t {
_unused: [u8; 0],
}
#[doc = "\n A Panel is a container in the views hierarchy that can contain other Views\n as children. Methods must be called on the browser process UI thread unless\n otherwise indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@@ -14905,11 +14880,6 @@ const _: () = {
};
#[doc = "\n Implement this structure to handle Button events. The functions of this\n structure will be called on the browser process UI thread unless otherwise\n indicated.\n"]
pub type cef_button_delegate_t = _cef_button_delegate_t;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_menu_button_t {
_unused: [u8; 0],
}
#[doc = "\n LabelButton is a button with optional text and/or icon. Methods must be\n called on the browser process UI thread unless otherwise indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
@@ -15013,3 +14983,477 @@ extern "C" {
text: *const cef_string_t,
) -> *mut cef_label_button_t;
}
#[doc = "\n MenuButton pressed lock is released when this object is destroyed.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_menu_button_pressed_lock_t {
#[doc = "\n Base structure.\n"]
pub base: cef_base_ref_counted_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _cef_menu_button_pressed_lock_t"]
[::std::mem::size_of::<_cef_menu_button_pressed_lock_t>() - 40usize];
["Alignment of _cef_menu_button_pressed_lock_t"]
[::std::mem::align_of::<_cef_menu_button_pressed_lock_t>() - 8usize];
["Offset of field: _cef_menu_button_pressed_lock_t::base"]
[::std::mem::offset_of!(_cef_menu_button_pressed_lock_t, base) - 0usize];
};
#[doc = "\n MenuButton pressed lock is released when this object is destroyed.\n"]
pub type cef_menu_button_pressed_lock_t = _cef_menu_button_pressed_lock_t;
#[doc = "\n Implement this structure to handle MenuButton events. The functions of this\n structure will be called on the browser process UI thread unless otherwise\n indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_menu_button_delegate_t {
#[doc = "\n Base structure.\n"]
pub base: cef_button_delegate_t,
#[doc = "\n Called when |button| is pressed. Call cef_menu_button_t::show_menu() to\n show a popup menu at |screen_point|. When showing a custom popup such as a\n window keep a reference to |button_pressed_lock| until the popup is hidden\n to maintain the pressed button state.\n"]
pub on_menu_button_pressed: ::std::option::Option<
unsafe extern "C" fn(
self_: *mut _cef_menu_button_delegate_t,
menu_button: *mut _cef_menu_button_t,
screen_point: *const cef_point_t,
button_pressed_lock: *mut _cef_menu_button_pressed_lock_t,
),
>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _cef_menu_button_delegate_t"]
[::std::mem::size_of::<_cef_menu_button_delegate_t>() - 152usize];
["Alignment of _cef_menu_button_delegate_t"]
[::std::mem::align_of::<_cef_menu_button_delegate_t>() - 8usize];
["Offset of field: _cef_menu_button_delegate_t::base"]
[::std::mem::offset_of!(_cef_menu_button_delegate_t, base) - 0usize];
["Offset of field: _cef_menu_button_delegate_t::on_menu_button_pressed"]
[::std::mem::offset_of!(_cef_menu_button_delegate_t, on_menu_button_pressed) - 144usize];
};
#[doc = "\n Implement this structure to handle MenuButton events. The functions of this\n structure will be called on the browser process UI thread unless otherwise\n indicated.\n"]
pub type cef_menu_button_delegate_t = _cef_menu_button_delegate_t;
#[doc = "\n MenuButton is a button with optional text, icon and/or menu marker that\n shows a menu when clicked with the left mouse button. All size and position\n values are in density independent pixels (DIP) unless otherwise indicated.\n Methods must be called on the browser process UI thread unless otherwise\n indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_menu_button_t {
#[doc = "\n Base structure.\n"]
pub base: cef_label_button_t,
#[doc = "\n Show a menu with contents |menu_model|. |screen_point| specifies the menu\n position in screen coordinates. |anchor_position| specifies how the menu\n will be anchored relative to |screen_point|. This function should be\n called from cef_menu_button_delegate_t::on_menu_button_pressed().\n"]
pub show_menu: ::std::option::Option<
unsafe extern "C" fn(
self_: *mut _cef_menu_button_t,
menu_model: *mut _cef_menu_model_t,
screen_point: *const cef_point_t,
anchor_position: cef_menu_anchor_position_t,
),
>,
#[doc = "\n Show the menu for this button. Results in a call to\n cef_menu_button_delegate_t::on_menu_button_pressed().\n"]
pub trigger_menu: ::std::option::Option<unsafe extern "C" fn(self_: *mut _cef_menu_button_t)>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _cef_menu_button_t"][::std::mem::size_of::<_cef_menu_button_t>() - 600usize];
["Alignment of _cef_menu_button_t"][::std::mem::align_of::<_cef_menu_button_t>() - 8usize];
["Offset of field: _cef_menu_button_t::base"]
[::std::mem::offset_of!(_cef_menu_button_t, base) - 0usize];
["Offset of field: _cef_menu_button_t::show_menu"]
[::std::mem::offset_of!(_cef_menu_button_t, show_menu) - 584usize];
["Offset of field: _cef_menu_button_t::trigger_menu"]
[::std::mem::offset_of!(_cef_menu_button_t, trigger_menu) - 592usize];
};
#[doc = "\n MenuButton is a button with optional text, icon and/or menu marker that\n shows a menu when clicked with the left mouse button. All size and position\n values are in density independent pixels (DIP) unless otherwise indicated.\n Methods must be called on the browser process UI thread unless otherwise\n indicated.\n"]
pub type cef_menu_button_t = _cef_menu_button_t;
extern "C" {
#[doc = "\n Create a new MenuButton. A |delegate| must be provided to call show_menu()\n when the button is clicked. |text| will be shown on the MenuButton and used\n as the default accessible name. If |with_frame| is true (1) the button will\n have a visible frame at all times, center alignment, additional padding and\n a default minimum size of 70x33 DIP. If |with_frame| is false (0) the button\n will only have a visible frame on hover/press, left alignment, less padding\n and no default minimum size.\n"]
pub fn cef_menu_button_create(
delegate: *mut _cef_menu_button_delegate_t,
text: *const cef_string_t,
) -> *mut cef_menu_button_t;
}
#[doc = "\n A ScrollView will show horizontal and/or vertical scrollbars when necessary\n based on the size of the attached content view. Methods must be called on\n the browser process UI thread unless otherwise indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_scroll_view_t {
#[doc = "\n Base structure.\n"]
pub base: cef_view_t,
#[doc = "\n Set the content View. The content View must have a specified size (e.g.\n via cef_view_t::SetBounds or cef_view_delegate_t::GetPreferredSize).\n"]
pub set_content_view: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_scroll_view_t, view: *mut _cef_view_t),
>,
#[doc = "\n Returns the content View.\n"]
pub get_content_view: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_scroll_view_t) -> *mut _cef_view_t,
>,
#[doc = "\n Returns the visible region of the content View.\n"]
pub get_visible_content_rect:
::std::option::Option<unsafe extern "C" fn(self_: *mut _cef_scroll_view_t) -> cef_rect_t>,
#[doc = "\n Returns true (1) if the horizontal scrollbar is currently showing.\n"]
pub has_horizontal_scrollbar: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_scroll_view_t) -> ::std::os::raw::c_int,
>,
#[doc = "\n Returns the height of the horizontal scrollbar.\n"]
pub get_horizontal_scrollbar_height: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_scroll_view_t) -> ::std::os::raw::c_int,
>,
#[doc = "\n Returns true (1) if the vertical scrollbar is currently showing.\n"]
pub has_vertical_scrollbar: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_scroll_view_t) -> ::std::os::raw::c_int,
>,
#[doc = "\n Returns the width of the vertical scrollbar.\n"]
pub get_vertical_scrollbar_width: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_scroll_view_t) -> ::std::os::raw::c_int,
>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _cef_scroll_view_t"][::std::mem::size_of::<_cef_scroll_view_t>() - 504usize];
["Alignment of _cef_scroll_view_t"][::std::mem::align_of::<_cef_scroll_view_t>() - 8usize];
["Offset of field: _cef_scroll_view_t::base"]
[::std::mem::offset_of!(_cef_scroll_view_t, base) - 0usize];
["Offset of field: _cef_scroll_view_t::set_content_view"]
[::std::mem::offset_of!(_cef_scroll_view_t, set_content_view) - 448usize];
["Offset of field: _cef_scroll_view_t::get_content_view"]
[::std::mem::offset_of!(_cef_scroll_view_t, get_content_view) - 456usize];
["Offset of field: _cef_scroll_view_t::get_visible_content_rect"]
[::std::mem::offset_of!(_cef_scroll_view_t, get_visible_content_rect) - 464usize];
["Offset of field: _cef_scroll_view_t::has_horizontal_scrollbar"]
[::std::mem::offset_of!(_cef_scroll_view_t, has_horizontal_scrollbar) - 472usize];
["Offset of field: _cef_scroll_view_t::get_horizontal_scrollbar_height"]
[::std::mem::offset_of!(_cef_scroll_view_t, get_horizontal_scrollbar_height) - 480usize];
["Offset of field: _cef_scroll_view_t::has_vertical_scrollbar"]
[::std::mem::offset_of!(_cef_scroll_view_t, has_vertical_scrollbar) - 488usize];
["Offset of field: _cef_scroll_view_t::get_vertical_scrollbar_width"]
[::std::mem::offset_of!(_cef_scroll_view_t, get_vertical_scrollbar_width) - 496usize];
};
#[doc = "\n A ScrollView will show horizontal and/or vertical scrollbars when necessary\n based on the size of the attached content view. Methods must be called on\n the browser process UI thread unless otherwise indicated.\n"]
pub type cef_scroll_view_t = _cef_scroll_view_t;
extern "C" {
#[doc = "\n Create a new ScrollView.\n"]
pub fn cef_scroll_view_create(delegate: *mut _cef_view_delegate_t) -> *mut cef_scroll_view_t;
}
#[doc = "\n Implement this structure to handle Textfield events. The functions of this\n structure will be called on the browser process UI thread unless otherwise\n indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_textfield_delegate_t {
#[doc = "\n Base structure.\n"]
pub base: cef_view_delegate_t,
#[doc = "\n Called when |textfield| receives a keyboard event. |event| contains\n information about the keyboard event. Return true (1) if the keyboard\n event was handled or false (0) otherwise for default handling.\n"]
pub on_key_event: ::std::option::Option<
unsafe extern "C" fn(
self_: *mut _cef_textfield_delegate_t,
textfield: *mut _cef_textfield_t,
event: *const cef_key_event_t,
) -> ::std::os::raw::c_int,
>,
#[doc = "\n Called after performing a user action that may change |textfield|.\n"]
pub on_after_user_action: ::std::option::Option<
unsafe extern "C" fn(
self_: *mut _cef_textfield_delegate_t,
textfield: *mut _cef_textfield_t,
),
>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _cef_textfield_delegate_t"]
[::std::mem::size_of::<_cef_textfield_delegate_t>() - 144usize];
["Alignment of _cef_textfield_delegate_t"]
[::std::mem::align_of::<_cef_textfield_delegate_t>() - 8usize];
["Offset of field: _cef_textfield_delegate_t::base"]
[::std::mem::offset_of!(_cef_textfield_delegate_t, base) - 0usize];
["Offset of field: _cef_textfield_delegate_t::on_key_event"]
[::std::mem::offset_of!(_cef_textfield_delegate_t, on_key_event) - 128usize];
["Offset of field: _cef_textfield_delegate_t::on_after_user_action"]
[::std::mem::offset_of!(_cef_textfield_delegate_t, on_after_user_action) - 136usize];
};
#[doc = "\n Implement this structure to handle Textfield events. The functions of this\n structure will be called on the browser process UI thread unless otherwise\n indicated.\n"]
pub type cef_textfield_delegate_t = _cef_textfield_delegate_t;
#[doc = "\n A Textfield supports editing of text. This control is custom rendered with\n no platform-specific code. Methods must be called on the browser process UI\n thread unless otherwise indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_textfield_t {
#[doc = "\n Base structure.\n"]
pub base: cef_view_t,
#[doc = "\n Sets whether the text will be displayed as asterisks.\n"]
pub set_password_input: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, password_input: ::std::os::raw::c_int),
>,
#[doc = "\n Returns true (1) if the text will be displayed as asterisks.\n"]
pub is_password_input: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> ::std::os::raw::c_int,
>,
#[doc = "\n Sets whether the text will read-only.\n"]
pub set_read_only: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, read_only: ::std::os::raw::c_int),
>,
#[doc = "\n Returns true (1) if the text is read-only.\n"]
pub is_read_only: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> ::std::os::raw::c_int,
>,
#[doc = "\n Returns the currently displayed text.\n"]
pub get_text: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> cef_string_userfree_t,
>,
#[doc = "\n Sets the contents to |text|. The cursor will be moved to end of the text\n if the current position is outside of the text range.\n"]
pub set_text: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, text: *const cef_string_t),
>,
#[doc = "\n Appends |text| to the previously-existing text.\n"]
pub append_text: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, text: *const cef_string_t),
>,
#[doc = "\n Inserts |text| at the current cursor position replacing any selected text.\n"]
pub insert_or_replace_text: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, text: *const cef_string_t),
>,
#[doc = "\n Returns true (1) if there is any selected text.\n"]
pub has_selection: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> ::std::os::raw::c_int,
>,
#[doc = "\n Returns the currently selected text.\n"]
pub get_selected_text: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> cef_string_userfree_t,
>,
#[doc = "\n Selects all text. If |reversed| is true (1) the range will end at the\n logical beginning of the text; this generally shows the leading portion of\n text that overflows its display area.\n"]
pub select_all: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, reversed: ::std::os::raw::c_int),
>,
#[doc = "\n Clears the text selection and sets the caret to the end.\n"]
pub clear_selection: ::std::option::Option<unsafe extern "C" fn(self_: *mut _cef_textfield_t)>,
#[doc = "\n Returns the selected logical text range.\n"]
pub get_selected_range:
::std::option::Option<unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> cef_range_t>,
#[doc = "\n Selects the specified logical text range.\n"]
pub select_range: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, range: *const cef_range_t),
>,
#[doc = "\n Returns the current cursor position.\n"]
pub get_cursor_position:
::std::option::Option<unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> usize>,
#[doc = "\n Sets the text color.\n"]
pub set_text_color: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, color: cef_color_t),
>,
#[doc = "\n Returns the text color.\n"]
pub get_text_color:
::std::option::Option<unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> cef_color_t>,
#[doc = "\n Sets the selection text color.\n"]
pub set_selection_text_color: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, color: cef_color_t),
>,
#[doc = "\n Returns the selection text color.\n"]
pub get_selection_text_color:
::std::option::Option<unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> cef_color_t>,
#[doc = "\n Sets the selection background color.\n"]
pub set_selection_background_color: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, color: cef_color_t),
>,
#[doc = "\n Returns the selection background color.\n"]
pub get_selection_background_color:
::std::option::Option<unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> cef_color_t>,
#[doc = "\n Sets the font list. The format is \"<FONT_FAMILY_LIST>,[STYLES] <SIZE>\",\n where:\n - FONT_FAMILY_LIST is a comma-separated list of font family names,\n - STYLES is an optional space-separated list of style names (case-\n sensitive \"Bold\" and \"Italic\" are supported), and\n - SIZE is an integer font size in pixels with the suffix \"px\".\n\n Here are examples of valid font description strings:\n - \"Arial, Helvetica, Bold Italic 14px\"\n - \"Arial, 14px\"\n"]
pub set_font_list: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, font_list: *const cef_string_t),
>,
#[doc = "\n Applies |color| to the specified |range| without changing the default\n color. If |range| is NULL the color will be set on the complete text\n contents.\n"]
pub apply_text_color: ::std::option::Option<
unsafe extern "C" fn(
self_: *mut _cef_textfield_t,
color: cef_color_t,
range: *const cef_range_t,
),
>,
#[doc = "\n Applies |style| to the specified |range| without changing the default\n style. If |add| is true (1) the style will be added, otherwise the style\n will be removed. If |range| is NULL the style will be set on the complete\n text contents.\n"]
pub apply_text_style: ::std::option::Option<
unsafe extern "C" fn(
self_: *mut _cef_textfield_t,
style: cef_text_style_t,
add: ::std::os::raw::c_int,
range: *const cef_range_t,
),
>,
#[doc = "\n Returns true (1) if the action associated with the specified command id is\n enabled. See additional comments on execute_command().\n"]
pub is_command_enabled: ::std::option::Option<
unsafe extern "C" fn(
self_: *mut _cef_textfield_t,
command_id: cef_text_field_commands_t,
) -> ::std::os::raw::c_int,
>,
#[doc = "\n Performs the action associated with the specified command id.\n"]
pub execute_command: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, command_id: cef_text_field_commands_t),
>,
#[doc = "\n Clears Edit history.\n"]
pub clear_edit_history:
::std::option::Option<unsafe extern "C" fn(self_: *mut _cef_textfield_t)>,
#[doc = "\n Sets the placeholder text that will be displayed when the Textfield is\n NULL.\n"]
pub set_placeholder_text: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, text: *const cef_string_t),
>,
#[doc = "\n Returns the placeholder text that will be displayed when the Textfield is\n NULL.\n"]
pub get_placeholder_text: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t) -> cef_string_userfree_t,
>,
#[doc = "\n Sets the placeholder text color.\n"]
pub set_placeholder_text_color: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, color: cef_color_t),
>,
#[doc = "\n Set the accessible name that will be exposed to assistive technology (AT).\n"]
pub set_accessible_name: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_textfield_t, name: *const cef_string_t),
>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _cef_textfield_t"][::std::mem::size_of::<_cef_textfield_t>() - 696usize];
["Alignment of _cef_textfield_t"][::std::mem::align_of::<_cef_textfield_t>() - 8usize];
["Offset of field: _cef_textfield_t::base"]
[::std::mem::offset_of!(_cef_textfield_t, base) - 0usize];
["Offset of field: _cef_textfield_t::set_password_input"]
[::std::mem::offset_of!(_cef_textfield_t, set_password_input) - 448usize];
["Offset of field: _cef_textfield_t::is_password_input"]
[::std::mem::offset_of!(_cef_textfield_t, is_password_input) - 456usize];
["Offset of field: _cef_textfield_t::set_read_only"]
[::std::mem::offset_of!(_cef_textfield_t, set_read_only) - 464usize];
["Offset of field: _cef_textfield_t::is_read_only"]
[::std::mem::offset_of!(_cef_textfield_t, is_read_only) - 472usize];
["Offset of field: _cef_textfield_t::get_text"]
[::std::mem::offset_of!(_cef_textfield_t, get_text) - 480usize];
["Offset of field: _cef_textfield_t::set_text"]
[::std::mem::offset_of!(_cef_textfield_t, set_text) - 488usize];
["Offset of field: _cef_textfield_t::append_text"]
[::std::mem::offset_of!(_cef_textfield_t, append_text) - 496usize];
["Offset of field: _cef_textfield_t::insert_or_replace_text"]
[::std::mem::offset_of!(_cef_textfield_t, insert_or_replace_text) - 504usize];
["Offset of field: _cef_textfield_t::has_selection"]
[::std::mem::offset_of!(_cef_textfield_t, has_selection) - 512usize];
["Offset of field: _cef_textfield_t::get_selected_text"]
[::std::mem::offset_of!(_cef_textfield_t, get_selected_text) - 520usize];
["Offset of field: _cef_textfield_t::select_all"]
[::std::mem::offset_of!(_cef_textfield_t, select_all) - 528usize];
["Offset of field: _cef_textfield_t::clear_selection"]
[::std::mem::offset_of!(_cef_textfield_t, clear_selection) - 536usize];
["Offset of field: _cef_textfield_t::get_selected_range"]
[::std::mem::offset_of!(_cef_textfield_t, get_selected_range) - 544usize];
["Offset of field: _cef_textfield_t::select_range"]
[::std::mem::offset_of!(_cef_textfield_t, select_range) - 552usize];
["Offset of field: _cef_textfield_t::get_cursor_position"]
[::std::mem::offset_of!(_cef_textfield_t, get_cursor_position) - 560usize];
["Offset of field: _cef_textfield_t::set_text_color"]
[::std::mem::offset_of!(_cef_textfield_t, set_text_color) - 568usize];
["Offset of field: _cef_textfield_t::get_text_color"]
[::std::mem::offset_of!(_cef_textfield_t, get_text_color) - 576usize];
["Offset of field: _cef_textfield_t::set_selection_text_color"]
[::std::mem::offset_of!(_cef_textfield_t, set_selection_text_color) - 584usize];
["Offset of field: _cef_textfield_t::get_selection_text_color"]
[::std::mem::offset_of!(_cef_textfield_t, get_selection_text_color) - 592usize];
["Offset of field: _cef_textfield_t::set_selection_background_color"]
[::std::mem::offset_of!(_cef_textfield_t, set_selection_background_color) - 600usize];
["Offset of field: _cef_textfield_t::get_selection_background_color"]
[::std::mem::offset_of!(_cef_textfield_t, get_selection_background_color) - 608usize];
["Offset of field: _cef_textfield_t::set_font_list"]
[::std::mem::offset_of!(_cef_textfield_t, set_font_list) - 616usize];
["Offset of field: _cef_textfield_t::apply_text_color"]
[::std::mem::offset_of!(_cef_textfield_t, apply_text_color) - 624usize];
["Offset of field: _cef_textfield_t::apply_text_style"]
[::std::mem::offset_of!(_cef_textfield_t, apply_text_style) - 632usize];
["Offset of field: _cef_textfield_t::is_command_enabled"]
[::std::mem::offset_of!(_cef_textfield_t, is_command_enabled) - 640usize];
["Offset of field: _cef_textfield_t::execute_command"]
[::std::mem::offset_of!(_cef_textfield_t, execute_command) - 648usize];
["Offset of field: _cef_textfield_t::clear_edit_history"]
[::std::mem::offset_of!(_cef_textfield_t, clear_edit_history) - 656usize];
["Offset of field: _cef_textfield_t::set_placeholder_text"]
[::std::mem::offset_of!(_cef_textfield_t, set_placeholder_text) - 664usize];
["Offset of field: _cef_textfield_t::get_placeholder_text"]
[::std::mem::offset_of!(_cef_textfield_t, get_placeholder_text) - 672usize];
["Offset of field: _cef_textfield_t::set_placeholder_text_color"]
[::std::mem::offset_of!(_cef_textfield_t, set_placeholder_text_color) - 680usize];
["Offset of field: _cef_textfield_t::set_accessible_name"]
[::std::mem::offset_of!(_cef_textfield_t, set_accessible_name) - 688usize];
};
#[doc = "\n A Textfield supports editing of text. This control is custom rendered with\n no platform-specific code. Methods must be called on the browser process UI\n thread unless otherwise indicated.\n"]
pub type cef_textfield_t = _cef_textfield_t;
extern "C" {
#[doc = "\n Create a new Textfield.\n"]
pub fn cef_textfield_create(delegate: *mut _cef_textfield_delegate_t) -> *mut cef_textfield_t;
}
#[doc = "\n A Layout handles the sizing of the children of a Panel according to\n implementation-specific heuristics. Methods must be called on the browser\n process UI thread unless otherwise indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_layout_t {
#[doc = "\n Base structure.\n"]
pub base: cef_base_ref_counted_t,
#[doc = "\n Returns this Layout as a BoxLayout or NULL if this is not a BoxLayout.\n"]
pub as_box_layout: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_layout_t) -> *mut _cef_box_layout_t,
>,
#[doc = "\n Returns this Layout as a FillLayout or NULL if this is not a FillLayout.\n"]
pub as_fill_layout: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_layout_t) -> *mut _cef_fill_layout_t,
>,
#[doc = "\n Returns true (1) if this Layout is valid.\n"]
pub is_valid: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_layout_t) -> ::std::os::raw::c_int,
>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _cef_layout_t"][::std::mem::size_of::<_cef_layout_t>() - 64usize];
["Alignment of _cef_layout_t"][::std::mem::align_of::<_cef_layout_t>() - 8usize];
["Offset of field: _cef_layout_t::base"][::std::mem::offset_of!(_cef_layout_t, base) - 0usize];
["Offset of field: _cef_layout_t::as_box_layout"]
[::std::mem::offset_of!(_cef_layout_t, as_box_layout) - 40usize];
["Offset of field: _cef_layout_t::as_fill_layout"]
[::std::mem::offset_of!(_cef_layout_t, as_fill_layout) - 48usize];
["Offset of field: _cef_layout_t::is_valid"]
[::std::mem::offset_of!(_cef_layout_t, is_valid) - 56usize];
};
#[doc = "\n A Layout handles the sizing of the children of a Panel according to\n implementation-specific heuristics. Methods must be called on the browser\n process UI thread unless otherwise indicated.\n"]
pub type cef_layout_t = _cef_layout_t;
#[doc = "\n A Layout manager that arranges child views vertically or horizontally in a\n side-by-side fashion with spacing around and between the child views. The\n child views are always sized according to their preferred size. If the\n host's bounds provide insufficient space, child views will be clamped.\n Excess space will not be distributed. Methods must be called on the browser\n process UI thread unless otherwise indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_box_layout_t {
#[doc = "\n Base structure.\n"]
pub base: cef_layout_t,
#[doc = "\n Set the flex weight for the given |view|. Using the preferred size as the\n basis, free space along the main axis is distributed to views in the ratio\n of their flex weights. Similarly, if the views will overflow the parent,\n space is subtracted in these ratios. A flex of 0 means this view is not\n resized. Flex values must not be negative.\n"]
pub set_flex_for_view: ::std::option::Option<
unsafe extern "C" fn(
self_: *mut _cef_box_layout_t,
view: *mut _cef_view_t,
flex: ::std::os::raw::c_int,
),
>,
#[doc = "\n Clears the flex for the given |view|, causing it to use the default flex\n specified via cef_box_layout_tSettings.default_flex.\n"]
pub clear_flex_for_view: ::std::option::Option<
unsafe extern "C" fn(self_: *mut _cef_box_layout_t, view: *mut _cef_view_t),
>,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _cef_box_layout_t"][::std::mem::size_of::<_cef_box_layout_t>() - 80usize];
["Alignment of _cef_box_layout_t"][::std::mem::align_of::<_cef_box_layout_t>() - 8usize];
["Offset of field: _cef_box_layout_t::base"]
[::std::mem::offset_of!(_cef_box_layout_t, base) - 0usize];
["Offset of field: _cef_box_layout_t::set_flex_for_view"]
[::std::mem::offset_of!(_cef_box_layout_t, set_flex_for_view) - 64usize];
["Offset of field: _cef_box_layout_t::clear_flex_for_view"]
[::std::mem::offset_of!(_cef_box_layout_t, clear_flex_for_view) - 72usize];
};
#[doc = "\n A Layout manager that arranges child views vertically or horizontally in a\n side-by-side fashion with spacing around and between the child views. The\n child views are always sized according to their preferred size. If the\n host's bounds provide insufficient space, child views will be clamped.\n Excess space will not be distributed. Methods must be called on the browser\n process UI thread unless otherwise indicated.\n"]
pub type cef_box_layout_t = _cef_box_layout_t;
#[doc = "\n A simple Layout that causes the associated Panel's one child to be sized to\n match the bounds of its parent. Methods must be called on the browser\n process UI thread unless otherwise indicated.\n"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct _cef_fill_layout_t {
#[doc = "\n Base structure.\n"]
pub base: cef_layout_t,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of _cef_fill_layout_t"][::std::mem::size_of::<_cef_fill_layout_t>() - 64usize];
["Alignment of _cef_fill_layout_t"][::std::mem::align_of::<_cef_fill_layout_t>() - 8usize];
["Offset of field: _cef_fill_layout_t::base"]
[::std::mem::offset_of!(_cef_fill_layout_t, base) - 0usize];
};
#[doc = "\n A simple Layout that causes the associated Panel's one child to be sized to\n match the bounds of its parent. Methods must be called on the browser\n process UI thread unless otherwise indicated.\n"]
pub type cef_fill_layout_t = _cef_fill_layout_t;
+19 -1
View File
@@ -158,7 +158,9 @@ fn download_prebuilt_cef(target: &str, cef_path: &std::path::Path) {
if cef_path.exists() {
std::fs::remove_dir_all(&cef_path).unwrap();
}
std::fs::rename(from, &cef_path).unwrap();
std::fs::rename(from.join("Release"), &cef_path).unwrap();
copy_directory(&from.join("Resources"), &cef_path);
std::fs::rename(from.join("include"), &cef_path.join("include")).unwrap();
println!("cef: extracted into {:?}", cef_path);
}
@@ -213,3 +215,19 @@ fn bindgen(target: &str, cef_path: &std::path::Path) {
std::io::stderr().write_all(&output.stderr).unwrap();
assert!(output.status.success());
}
fn copy_directory(src: &std::path::Path, dst: &std::path::Path) {
std::fs::create_dir_all(dst).unwrap();
for entry in std::fs::read_dir(src).unwrap() {
let entry = entry.unwrap();
let src_path = entry.path();
let dst_path = dst.join(entry.file_name());
if entry.file_type().unwrap().is_dir() {
copy_directory(&src_path, &dst_path);
} else {
std::fs::copy(&src_path, &dst_path).unwrap();
}
}
}
+25 -2
View File
@@ -1,14 +1,37 @@
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_app_capi.h"
#include "include/capi/cef_browser_capi.h"
#include "include/capi/cef_browser_process_handler_capi.h"
#include "include/capi/cef_client_capi.h"
#include "include/capi/cef_command_line_capi.h"
#include "include/capi/cef_command_handler_capi.h"
// views
#include "include/capi/views/cef_browser_view_capi.h"
#include "include/capi/views/cef_browser_view_delegate_capi.h"
#include "include/capi/views/cef_window_capi.h"
#include "include/capi/views/cef_window_delegate_capi.h"
#include "include/capi/views/cef_button_capi.h"
#include "include/capi/views/cef_button_delegate_capi.h"
#include "include/capi/views/cef_label_button_capi.h"
#include "include/capi/views/cef_menu_button_capi.h"
#include "include/capi/views/cef_menu_button_delegate_capi.h"
#include "include/capi/views/cef_panel_capi.h"
#include "include/capi/cef_command_line_capi.h"
#include "include/capi/cef_command_handler_capi.h"
#include "include/capi/views/cef_panel_delegate_capi.h"
#include "include/capi/views/cef_scroll_view_capi.h"
#include "include/capi/views/cef_textfield_capi.h"
#include "include/capi/views/cef_textfield_delegate_capi.h"
#include "include/capi/views/cef_box_layout_capi.h"
#include "include/capi/views/cef_fill_layout_capi.h"
#include "include/capi/views/cef_layout_capi.h"
#include "include/capi/views/cef_display_capi.h"
#include "include/capi/views/cef_overlay_controller_capi.h"