wlmaker
Loading...
Searching...
No Matches
Classes | Functions | Variables
action_item.c File Reference
#include "action_item.h"
#include <libbase/libbase.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <wayland-server-core.h>
#include "root_menu.h"
Include dependency graph for action_item.c:

Classes

struct  _wlmaker_action_item_t
 

Functions

static void _wlmaker_action_item_handle_triggered (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_action_item_handle_destroy (struct wl_listener *listener_ptr, void *data_ptr)
 
wlmaker_action_item_twlmaker_action_item_create (const char *text_ptr, const wlmtk_menu_item_style_t *style_ptr, wlmaker_action_t action, const char *action_arg_ptr, wlmaker_server_t *server_ptr)
 
wlmaker_action_item_twlmaker_action_item_create_from_desc (const wlmaker_action_item_desc_t *desc_ptr, void *dest_ptr, const wlmtk_menu_item_style_t *style_ptr, wlmaker_server_t *server_ptr)
 
void wlmaker_action_item_destroy (wlmaker_action_item_t *action_item_ptr)
 
wlmtk_menu_item_twlmaker_action_item_menu_item (wlmaker_action_item_t *action_item_ptr)
 
static void _wlmaker_action_item_test_create (bs_test_t *test_ptr)
 
static void _wlmaker_action_item_test_menu_dtor (bs_test_t *test_ptr)
 

Variables

const bs_test_case_t wlmaker_action_item_test_cases []
 
static const wlmtk_menu_style_t _wlmaker_action_item_menu_style = {}
 
static const wlmaker_action_item_desc_t _wlmaker_action_item_desc
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ _wlmaker_action_item_handle_destroy()

void _wlmaker_action_item_handle_destroy ( struct wl_listener *  listener_ptr,
void *  data_ptr 
)
static

Handles wlmtk_menu_item_events_t::destroy. Destroy the action item.

◆ _wlmaker_action_item_handle_triggered()

void _wlmaker_action_item_handle_triggered ( struct wl_listener *  listener_ptr,
void *  data_ptr 
)
static

Handles wlmtk_menu_item_events_t::triggered. Triggers the action

◆ _wlmaker_action_item_test_create()

void _wlmaker_action_item_test_create ( bs_test_t *  test_ptr)
static

Tests creation the menu item.

◆ _wlmaker_action_item_test_menu_dtor()

void _wlmaker_action_item_test_menu_dtor ( bs_test_t *  test_ptr)
static

Tests that dtors are called as deisred from the menu.

◆ wlmaker_action_item_create()

wlmaker_action_item_t * wlmaker_action_item_create ( const char *  text_ptr,
const wlmtk_menu_item_style_t style_ptr,
wlmaker_action_t  action,
const char *  action_arg_ptr,
wlmaker_server_t server_ptr 
)

Creates a menu item that triggers a wlmaker_action_t.

Parameters
text_ptr
style_ptr
action
action_arg_ptrExtra argument. Will be duplicated.
server_ptr
Returns
Poitner to the menu item's handle or NULL on error.

◆ wlmaker_action_item_create_from_desc()

wlmaker_action_item_t * wlmaker_action_item_create_from_desc ( const wlmaker_action_item_desc_t desc_ptr,
void *  dest_ptr,
const wlmtk_menu_item_style_t style_ptr,
wlmaker_server_t server_ptr 
)

Creates a menu item triggering an action item from a descriptor.

Parameters
desc_ptr
dest_ptr
style_ptr
server_ptr
Returns
Pointer to the item's handle or NULL on error.

◆ wlmaker_action_item_destroy()

void wlmaker_action_item_destroy ( wlmaker_action_item_t action_item_ptr)

Destroys the action-triggering menu item.

Parameters
action_item_ptr

◆ wlmaker_action_item_menu_item()

wlmtk_menu_item_t * wlmaker_action_item_menu_item ( wlmaker_action_item_t action_item_ptr)
Returns
pointer to the superclass wlmtk_menu_item_t.

Variable Documentation

◆ _wlmaker_action_item_desc

const wlmaker_action_item_desc_t _wlmaker_action_item_desc
static
Initial value:
= {
"text", 42, NULL, 0
}

Test data: Descriptor for the action item used in tests.

◆ _wlmaker_action_item_menu_style

const wlmtk_menu_style_t _wlmaker_action_item_menu_style = {}
static

Test data: style for the menu item.

◆ wlmaker_action_item_test_cases

const bs_test_case_t wlmaker_action_item_test_cases[]
Initial value:
= {
{ 0, NULL, NULL },
}
static void _wlmaker_action_item_test_menu_dtor(bs_test_t *test_ptr)
Definition action_item.c:225
static void _wlmaker_action_item_test_create(bs_test_t *test_ptr)
Definition action_item.c:208

Test cases for action items.