wlmaker
Loading...
Searching...
No Matches
Classes | Functions | Variables
dock.c File Reference
#include "dock.h"
#include <inttypes.h>
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <stdbool.h>
#include <stdlib.h>
#include "box.h"
#include "container.h"
Include dependency graph for dock.c:

Classes

struct  _wlmtk_dock_t
 

Functions

static uint32_t _wlmtk_dock_panel_request_size (wlmtk_panel_t *panel_ptr, int width, int height)
 
static void _wlmtk_dock_element_layout (wlmtk_element_t *element_ptr)
 
static wlmtk_box_orientation_t _wlmtk_dock_orientation (wlmtk_dock_t *dock_ptr)
 
static bool _wlmtk_dock_positioning (wlmtk_dock_t *dock_ptr, wlmtk_panel_positioning_t *panel_positioning_ptr)
 
static bool _wlmtk_dock_tile_set_style (bs_dllist_node_t *dlnode_ptr, void *ud_ptr)
 
static void _wlmtk_dock_tile_destroy (bs_dllist_node_t *dlnode_ptr, void *ud_ptr)
 
wlmtk_dock_twlmtk_dock_create (const wlmtk_dock_positioning_t *dock_positioning_ptr, const struct wlmtk_dock_style *style_ptr)
 
void wlmtk_dock_destroy (wlmtk_dock_t *dock_ptr)
 
bool wlmtk_dock_set_style (wlmtk_dock_t *dock_ptr, const struct wlmtk_dock_style *style_ptr, const struct wlmtk_tile_style *tile_style_ptr)
 
void wlmtk_dock_add_tile (wlmtk_dock_t *dock_ptr, wlmtk_tile_t *tile_ptr)
 
void wlmtk_dock_remove_tile (wlmtk_dock_t *dock_ptr, wlmtk_tile_t *tile_ptr)
 
wlmtk_panel_twlmtk_dock_panel (wlmtk_dock_t *dock_ptr)
 
wlmtk_element_twlmtk_dock_element (wlmtk_dock_t *dock_ptr)
 
static void test_create_destroy (bs_test_t *test_ptr)
 

Variables

const bspl_desc_t wlmtk_dock_style_desc []
 
static const wlmtk_panel_vmt_t _wlmtk_dock_panel_vmt
 
static const wlmtk_element_vmt_t _wlmtk_dock_element_vmt
 
static const bs_test_case_t _wlmtk_dock_test_cases []
 
const bs_test_set_t wlmtk_dock_test_set
 

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

◆ _wlmtk_dock_element_layout()

void _wlmtk_dock_element_layout ( wlmtk_element_t element_ptr)
static

Redraw the dock. We also (re)request size, ie. the positioning.

◆ _wlmtk_dock_orientation()

wlmtk_box_orientation_t _wlmtk_dock_orientation ( wlmtk_dock_t dock_ptr)
static

Derives the box' orientation for the dock.

◆ _wlmtk_dock_panel_request_size()

uint32_t _wlmtk_dock_panel_request_size ( wlmtk_panel_t panel_ptr,
int  width,
int  height 
)
static

Recomputes the dock's size – and also commits it.

Parameters
panel_ptr
width
height
Returns
0

◆ _wlmtk_dock_positioning()

bool _wlmtk_dock_positioning ( wlmtk_dock_t dock_ptr,
wlmtk_panel_positioning_t panel_positioning_ptr 
)
static

Fills the panel positioning parameters from the dock's.

◆ _wlmtk_dock_tile_destroy()

void _wlmtk_dock_tile_destroy ( bs_dllist_node_t *  dlnode_ptr,
void *  ud_ptr 
)
static

Iterator to bs_dllist_for_each(): Removes & destroys the tile at node.

◆ _wlmtk_dock_tile_set_style()

bool _wlmtk_dock_tile_set_style ( bs_dllist_node_t *  dlnode_ptr,
void *  ud_ptr 
)
static

Iterator to bs_dllist_all(): Sets style for a tile in the iterator.

◆ test_create_destroy()

void test_create_destroy ( bs_test_t *  test_ptr)
static

Exercises ctor and dtor.

◆ wlmtk_dock_add_tile()

void wlmtk_dock_add_tile ( wlmtk_dock_t dock_ptr,
wlmtk_tile_t tile_ptr 
)

Adds the tile to the dock.

Parameters
dock_ptr
tile_ptr

◆ wlmtk_dock_create()

wlmtk_dock_t * wlmtk_dock_create ( const wlmtk_dock_positioning_t dock_positioning_ptr,
const struct wlmtk_dock_style style_ptr 
)

Creates a dock. A dock contains icons, launchers and the likes.

The dock is an implementation of a wlmtk_panel_t.

Parameters
dock_positioning_ptr
style_ptr
Returns
The dock handle, or NULL on error. Must be destroyed calling wlmtk_dock_destroy.

◆ wlmtk_dock_destroy()

void wlmtk_dock_destroy ( wlmtk_dock_t dock_ptr)

Destroys the dock.

Parameters
dock_ptr

◆ wlmtk_dock_element()

wlmtk_element_t * wlmtk_dock_element ( wlmtk_dock_t dock_ptr)
Returns
Pointer to the superclass wlmtk_element_t of dock_ptr.

◆ wlmtk_dock_panel()

wlmtk_panel_t * wlmtk_dock_panel ( wlmtk_dock_t dock_ptr)
Returns
Pointer to the superclass wlmtk_panel_t of dock_ptr.

◆ wlmtk_dock_remove_tile()

void wlmtk_dock_remove_tile ( wlmtk_dock_t dock_ptr,
wlmtk_tile_t tile_ptr 
)

Removes the tile from the dock.

Parameters
dock_ptr
tile_ptr

◆ wlmtk_dock_set_style()

bool wlmtk_dock_set_style ( wlmtk_dock_t dock_ptr,
const struct wlmtk_dock_style style_ptr,
const struct wlmtk_tile_style tile_style_ptr 
)

Sets the style for the dock, including all contained tiles.

Parameters
dock_ptr
style_ptr
tile_style_ptr
Returns
true on success.

Variable Documentation

◆ _wlmtk_dock_element_vmt

const wlmtk_element_vmt_t _wlmtk_dock_element_vmt
static
Initial value:
= {
}
static void _wlmtk_dock_element_layout(wlmtk_element_t *element_ptr)
Definition dock.c:259

Virtual method table of the panel's element.

◆ _wlmtk_dock_panel_vmt

const wlmtk_panel_vmt_t _wlmtk_dock_panel_vmt
static
Initial value:
= {
}
static uint32_t _wlmtk_dock_panel_request_size(wlmtk_panel_t *panel_ptr, int width, int height)
Definition dock.c:239

Virtual method table of the panel.

◆ _wlmtk_dock_test_cases

const bs_test_case_t _wlmtk_dock_test_cases[]
static
Initial value:
= {
{ 1, "create_destroy", test_create_destroy },
}
static void test_create_destroy(bs_test_t *test_ptr)
Definition dock.c:356

Test cases

◆ wlmtk_dock_style_desc

const bspl_desc_t wlmtk_dock_style_desc[]
Initial value:
= {
BSPL_DESC_DICT(
"Margin", true, struct wlmtk_dock_style, margin, margin,
}
Definition dock.h:52
const bspl_desc_t wlmtk_style_margin_desc[]
Definition style.c:29

Plist decoding descriptor of the dock's style.

◆ wlmtk_dock_test_set

const bs_test_set_t wlmtk_dock_test_set
Initial value:
= BS_TEST_SET(
true, "dock", _wlmtk_dock_test_cases)
static const bs_test_case_t _wlmtk_dock_test_cases[]
Definition dock.c:372

Unit tests for wlmtk_dock_t.